[PATCH] D70285: Wrap C APIs with pragmas enforcing -Werror=strict-prototypes

Duncan P. N. Exon Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 15 13:13:05 PST 2019


dexonsmith marked 2 inline comments as done.
dexonsmith added inline comments.


================
Comment at: clang/include/clang-c/ExternC.h:18-19
+#define LLVM_CLANG_C_STRING_PROTOTYPES_BEGIN                                   \
+  _Pragma("clang diagnostic push")                                             \
+      _Pragma("clang diagnostic error \"-Wstrict-prototypes\"")
+#define LLVM_CLANG_C_STRING_PROTOTYPES_END _Pragma("clang diagnostic pop")
----------------
aaron.ballman wrote:
> I think this needs some extra compiler guards, unfortunately. I don't think MSVC supports `_Pragma` (IIRC, they rather oddly decided to call it `__pragma` instead). Do we want to restrict this pragma to only clang compilers? Do we need to do something to support GCC as well?
Thanks for pointing this out; guarded against `_MSC_VER` in the updated diff.

Supporting GCC as a follow-up sounds nice to me if someone is interested in sorting that out, but covering it in Clang like this is sufficient to get our bots to reject commits that regress.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70285/new/

https://reviews.llvm.org/D70285





More information about the llvm-commits mailing list