Why do you want to get rid of the #ifdefs? Using #pragma once doesn't speed up the compiling.
Are you using the Keil compiler (for PsoC3) or gcc? This might actually be a bug in the syntax checker of Creator (I think its using LLVM under the hood for that).
Nope, I'm using the built-in PSoC 4 ARM compiler, not Keil.
I've used the #ifndef guards for years too, but I'm trying to modernize my use of C a little, and those guards are ugly. It's much nicer to just stick "#pragma once" on the first line of every .h file and not worry about accidentally closing the #ifndef, etc. Pure aesthetics.
Then you should raise a support case with Cypress.
Since there is no compiler warning it will not effect the functioning of application.
1 of 1 people found this helpful
We support C99 and #pragma once is not part of that definition. As a result we are reticent about enabling it. Our roadmap includes support for more third party software tools and so we're a bit wary of investing in non-standard extensions.
I agree that the #ifndef method is uglier, of course, and so I hope you are OK living with it.
OK, I guess I can do that. Although it's pretty well supported for a nonstandard #pragma, including by the ARM compiler, Keil (http://www.keil.com/support/man/docs/armclang_ref/armclang_ref_chr1359124989221.htm) and IAR. Although ARM doesn't recommend it, most books on modern C programming do.
Portability (from Wikipedia page on #pragma once:
Comeau C/C++ Supported
C++Builder XE3 Supported
Digital Mars C++ Supported
GCC Supported (since 3.4)
HP C/aC++ Supported (since at least A.06.12)
IBM XL C/C++ Supported (since 13.1.1)
Intel C++ Compiler Supported
Microsoft Visual C++ Supported (since 4.2)
Pelles C Supported
ARM DS-5 Supported
IAR C/C++ Supported
Oracle Developer Studio C/C++ Supported (since 12.5)
Portland Group C/C++ Not supported