pio: Add 'pragma once' to generated header files (#237)

We can't really use traditional include guards, because the header file may be piped to stdout (which means we might not have a file name).
This commit is contained in:
Christian Flach 2021-03-08 19:21:36 +01:00 committed by GitHub
parent 20b9823aca
commit 090c5cd83b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -68,6 +68,8 @@ struct c_sdk_output : public output_format {
header(out, "This file is autogenerated by pioasm; do not edit!"); header(out, "This file is autogenerated by pioasm; do not edit!");
fprintf(out, "#pragma once\n");
fprintf(out, "\n");
fprintf(out, "#if !PICO_NO_HARDWARE\n"); fprintf(out, "#if !PICO_NO_HARDWARE\n");
fprintf(out, "#include \"hardware/pio.h\"\n"); fprintf(out, "#include \"hardware/pio.h\"\n");
fprintf(out, "#endif\n"); fprintf(out, "#endif\n");