Hi there, The NVidia/PGI compiler has some interesting behaviour regarding noreturn placement around storage specifiers. This creates a limitation in making a wrapper macro that can be both `[[noreturn]]` in C++ and `_Noreturn` in C. In C++ the `[[noreturn]]` attribute must come before storage class specifiers. Example: ```c++ [[noreturn]] static void fatal(const char* msg) { fprintf(stderr, "%s\n", msg); abort(); } ``` Many compilers including GCC `g++` and NVidia `nvc++` enforce this. They give an attribute error if `[[noreturn]]` is placed after `static`. However, in C, the NVidia/PGI compiler under `-Wpedantic` requires that the storage specifier come first. The definition has to look like this: ```c static _Noreturn void fatal(const char* msg) { fprintf(stderr, "%s\n", msg); abort(); } ``` If `_Noreturn` is instead placed before `static`, the NVidia compiler throws a pedantic warning. This is the only compiler I've found that complains about this. This creates a problem with your `HEDLEY_NO_RETURN` macro. Suppose I am making a header-only library that can be included in both C and C++ and I want to declare a noreturn static function. Where do I put `HEDLEY_NO_RETURN`? It's easy to reproduce this with your test suite. With nvc 22.5 in `hedley/test/`: ```sh nvc --display_error_number -Wpedantic -Werror no-return.c ``` This prints: ``` "no-return.c", line 22: error #82: storage class is not first static void ^ 1 error detected in the compilation of "no-return.c". ``` What do you think would be the best way to handle this? Since NVidia is the outlier here it's possible to simply silence the warning: `_Pragma("diag_suppress 82")` works. I don't know what else this error number might silence though. Unfortunately NVidia doesn't support push/pop for silencing warnings so I can't scope this to my own header files either. Do you think this pragma should be added to `HEDLEY_NO_RETURN` under these specific circumstances to silence it automatically? Or do you want to document this behaviour and have users disable the warning themselves? Full disclosure, I ask because I am making my own portability library similar to Hedley and portable-snippets. I suppose it will be a competitor of sorts but I am hoping we can help each other out to make all of them good. (And although I haven't used anything from Hedley or portable-snippets yet, my library will also be under a public-domain-equivalent license so we could share pieces of code back and forth if you're open to it.) Anyway I ran into this problem with my own library and was curious to see whether you handled it. Looks like you haven't yet. Your library doesn't appear to generate tests for NVidia/PGI although it has a lot of code specific to their compiler. Do you test with the NVidia compiler? (I am hoping you have some tests for it because I have a bigger problem with NVidia regarding unreachable code that I might ask about next...)
This issue appears to be discussing a feature request or bug report related to the repository. Based on the content, it seems to be still under discussion. The issue was opened by ludocode and has received 1 comments.