Skip to content

codegen: Emit diagnostics pragmata for GCC 14, Clang 16 compatibility

Florian Weimer requested to merge fweimer/vala:gcc14 into main

GCC 14 refuses to compile C sources with certain type errors, to provide prompt feedback to programmers about mistakes. Vala does not generate valid C in some cases (see issues #358, #1005, #1408, and perhaps others). As a stop-gap measure, this commit introduces pragmata to turn the relevant GCC diagnostics into warnings. For experimentation, this can be avoided at C compilation time by defining the VALA_STRICT_C macro.

Clang 16 is broadly similar, except that it is not possible to turn the errors into warnings using #pragma. They have to be disabled completely. In Clang 16 and 17, -Wincompatible-pointer-types is not an error yet, but that is likely to change in future Clang versions, so this commit disables this warning, too. Another error, -Wincompatible-function-pointer-types has been split from that, and needs to be disabled. Clang does not yet have -Wreturn-mismatch, but instead turns a subset of -Wreturn-type into errors, so that needs to be disabled as well. Related to:

Edited by Florian Weimer

Merge request reports