]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
compat.h: Ensure check for `__STDC_VERSION__` is not attempted for c++.
authorGeorge Joseph <gjoseph@sangoma.com>
Mon, 27 Apr 2026 17:52:27 +0000 (11:52 -0600)
committergithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Tue, 28 Apr 2026 13:18:16 +0000 (13:18 +0000)
`__STDC_VERSION__` is specific to C but up until gcc 16, the g++ compiler
also defined it.  With g++ 16.0 it's no longer defined (which is the correct
behavior) so compiling channelstorage_cpp_map_name_id.cc fails.  The
check for `__STDC_VERSION__` in compat.h is now skipped if we're compiling
a C++ source file.

Resolves: #1903

include/asterisk/compat.h

index 85472837c0cf79d8d5179627d8e86009f8fd5865..ccde1eec7d627ed4df55aa8e5cd24f6feb3db01c 100644 (file)
 
 #include "asterisk/compiler.h"
 
+#if !defined(__cplusplus) && !defined(c_plusplus)
 #ifndef __STDC_VERSION__
 /* flex output wants to find this defined. */
 #define        __STDC_VERSION__ 0
 #endif
+#endif
 
 #include <inttypes.h>
 #include <limits.h>