asterisk / pjproject-archive

Asterisk fork of PJSIP NO PULL REQUESTS OR ISSUES!!!
GNU General Public License v2.0
69 stars 42 forks source link

C++ program using pjproject fails to compile with GCC 5 #18

Closed zorun closed 6 years ago

zorun commented 9 years ago

isblank is redefined as a macro in pjlib/include/pj/compat/ctype.h. Since gcc 5, the handling of the builtin isblank functions have changed in C++, see https://gcc.gnu.org/gcc-5/changes.html#libstdcxx

As a result, some applications including pjproject may fail to compile, see for instance https://projects.savoirfairelinux.com/issues/73855

I'm not sure of the proper way to fix this in all cases (C, C++, old & new systems), but the following patch applied to pjproject allowed ring-daemon to compile:

--- pjproject/pjlib/include/pj/compat/ctype.h.orig      2015-05-25 22:45:17.862889506 +0200
+++ pjproject/pjlib/include/pj/compat/ctype.h   2015-05-25 22:54:41.889520387 +0200
@@ -39,11 +39,12 @@
 #  define isxdigit(c)      (isdigit(c) || (tolower(c)>='a'&&tolower(c)<='f'))
 #  define tolower(c)       (((c) >= 'A' && (c) <= 'Z') ? (c)+('a'-'A') : (c))
 #  define toupper(c)       (((c) >= 'a' && (c) <= 'z') ? (c)-('a'-'A') : (c))
-#endif

 #ifndef isblank
 #   define isblank(c)      (c==' ' || c=='\t')
 #endif

+#endif
+

 #endif /* __PJ_COMPAT_CTYPE_H__ */