From: George Joseph Date: Mon, 27 Apr 2026 17:52:27 +0000 (-0600) Subject: compat.h: Ensure check for `__STDC_VERSION__` is not attempted for c++. X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=7a57d9f2ed4e61ec0cd7e5b71ed97ecebeeb743b;p=thirdparty%2Fasterisk.git compat.h: Ensure check for `__STDC_VERSION__` is not attempted for c++. `__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 --- diff --git a/include/asterisk/compat.h b/include/asterisk/compat.h index 85472837c0..ccde1eec7d 100644 --- a/include/asterisk/compat.h +++ b/include/asterisk/compat.h @@ -22,10 +22,12 @@ #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 #include