diff options
author | Olly Betts <olly@survex.com> | 2022-09-29 11:06:56 +1300 |
---|---|---|
committer | Olly Betts <olly@survex.com> | 2022-09-29 11:06:56 +1300 |
commit | cb9c96011a42fb763e447da5869655f50d19f914 (patch) | |
tree | 152c02b0d0bee094202a7d948f67c355b5cc94a2 | |
parent | 246dd2d787ffe7fda72598415e0768482acf053e (diff) | |
download | swig-cb9c96011a42fb763e447da5869655f50d19f914.tar.gz |
[php] Suppress -Wdeclaration-after-statement in php.h
In PHP 8.2 zend_operators.h contains inline code which triggers this
warning and our testsuite uses with option and -Werror.
I don't see a good way to only do this within our testsuite, but
disabling it globally like this shouldn't be problematic.
-rw-r--r-- | Source/Modules/php.cxx | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/Source/Modules/php.cxx b/Source/Modules/php.cxx index a661a0a91..3f12c0448 100644 --- a/Source/Modules/php.cxx +++ b/Source/Modules/php.cxx @@ -551,9 +551,28 @@ public: // the PHP headers defines _GNU_SOURCE, includes string.h (which is a // no op thanks to the include gaurds), then tries to use memrchr() and // fails. - Append(f_runtime, "#include \"php.h\"\n\n"); - - Printf(f_runtime, "\n\n#ifndef SWIGPHP\n#define SWIGPHP\n#endif\n\n"); + // + // We also need to suppress -Wdeclaration-after-statement if enabled + // since with PHP 8.2 zend_operators.h contains inline code which triggers + // this warning and our testsuite uses with option and -Werror. I don't + // see a good way to only do this within our testsuite, but disabling + // it globally like this shouldn't be problematic. + Append(f_runtime, + "\n" + "#if defined __GNUC__ && !defined __cplusplus\n" + "# if __GNUC__ >= 4\n" + "# pragma GCC diagnostic push\n" + "# pragma GCC diagnostic ignored \"-Wdeclaration-after-statement\"\n" + "# endif\n" + "#endif\n" + "#include \"php.h\"\n" + "#if defined __GNUC__ && !defined __cplusplus\n" + "# if __GNUC__ >= 4\n" + "# pragma GCC diagnostic pop\n" + "# endif\n" + "#endif\n\n"); + + Printf(f_runtime, "#ifndef SWIGPHP\n#define SWIGPHP\n#endif\n\n"); if (directorsEnabled()) { Printf(f_runtime, "#define SWIG_DIRECTORS\n"); |