<p>Corey Farrell has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/6130">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">Fix compile error for old versions of GCC.<br><br>Use -Wno-format-truncation only if supported by compiler.<br><br>ASTERISK-27171 #close<br><br>Change-Id: Iac0aed7a5bcaa16c21b7d62c4e4678d244c4ccb6<br>---<br>M apps/Makefile<br>M channels/Makefile<br>M configure<br>M configure.ac<br>M main/Makefile<br>M makeopts.in<br>6 files changed, 34 insertions(+), 21 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/30/6130/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/apps/Makefile b/apps/Makefile<br>index efc8329..87e45bb 100644<br>--- a/apps/Makefile<br>+++ b/apps/Makefile<br>@@ -30,7 +30,7 @@<br> clean::<br>       rm -f confbridge/*.o confbridge/*.i confbridge/*.gcda confbridge/*.gcno<br> <br>-app_voicemail.o: _ASTCFLAGS+=-Wno-format-truncation<br>+app_voicemail.o: _ASTCFLAGS+=$(AST_NO_FORMAT_TRUNCATION)<br> <br> app_confbridge.so: $(subst .c,.o,$(wildcard confbridge/*.c))<br> $(subst .c,.o,$(wildcard confbridge/*.c)): _ASTCFLAGS+=$(call MOD_ASTCFLAGS,app_confbridge)<br>diff --git a/channels/Makefile b/channels/Makefile<br>index 3754007..fdc1390 100644<br>--- a/channels/Makefile<br>+++ b/channels/Makefile<br>@@ -49,7 +49,7 @@<br> chan_dahdi.so: $(CHAN_DAHDI_OBJS)<br> $(CHAN_DAHDI_OBJS): _ASTCFLAGS+=$(call MOD_ASTCFLAGS,chan_dahdi)<br> <br>-chan_mgcp.o: _ASTCFLAGS+=-Wno-format-truncation<br>+chan_mgcp.o: _ASTCFLAGS+=$(AST_NO_FORMAT_TRUNCATION)<br> <br> chan_misdn.o: _ASTCFLAGS+=-Imisdn<br> <br>diff --git a/configure b/configure<br>index 7618f1d..96955d4 100755<br>--- a/configure<br>+++ b/configure<br>@@ -701,6 +701,7 @@<br> AST_RPATH<br> AST_NATIVE_ARCH<br> AST_SHADOW_WARNINGS<br>+AST_NO_FORMAT_TRUNCATION<br> AST_NO_STRICT_OVERFLOW<br> AST_FORTIFY_SOURCE<br> AST_TRAMPOLINES<br>@@ -1328,7 +1329,6 @@<br> docdir<br> oldincludedir<br> includedir<br>-runstatedir<br> localstatedir<br> sharedstatedir<br> sysconfdir<br>@@ -1509,7 +1509,6 @@<br> sysconfdir='${prefix}/etc'<br> sharedstatedir='${prefix}/com'<br> localstatedir='${prefix}/var'<br>-runstatedir='${localstatedir}/run'<br> includedir='${prefix}/include'<br> oldincludedir='/usr/include'<br> docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'<br>@@ -1762,15 +1761,6 @@<br>   | -silent | --silent | --silen | --sile | --sil)<br>     silent=yes ;;<br> <br>-  -runstatedir | --runstatedir | --runstatedi | --runstated \<br>-  | --runstate | --runstat | --runsta | --runst | --runs \<br>-  | --run | --ru | --r)<br>-    ac_prev=runstatedir ;;<br>-  -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \<br>-  | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \<br>-  | --run=* | --ru=* | --r=*)<br>-    runstatedir=$ac_optarg ;;<br>-<br>   -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)<br>     ac_prev=sbindir ;;<br>   -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \<br>@@ -1908,7 +1898,7 @@<br> for ac_var in       exec_prefix prefix bindir sbindir libexecdir datarootdir \<br>            datadir sysconfdir sharedstatedir localstatedir includedir \<br>          oldincludedir docdir infodir htmldir dvidir pdfdir psdir \<br>-           libdir localedir mandir runstatedir<br>+          libdir localedir mandir<br> do<br>   eval ac_val=\$$ac_var<br>   # Remove trailing slashes.<br>@@ -2061,7 +2051,6 @@<br>   --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]<br>   --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]<br>   --localstatedir=DIR     modifiable single-machine data [PREFIX/var]<br>-  --runstatedir=DIR       modifiable per-process data [LOCALSTATEDIR/run]<br>   --libdir=DIR            object code libraries [EPREFIX/lib]<br>   --includedir=DIR        C header files [PREFIX/include]<br>   --oldincludedir=DIR     C header files for non-gcc [/usr/include]<br>@@ -14685,7 +14674,7 @@<br>     We can't simply define LARGE_OFF_T to be 9223372036854775807,<br>     since some C++ compilers masquerading as C compilers<br>     incorrectly reject 9223372036854775807.  */<br>-#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))<br>+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))<br>   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721<br>                    && LARGE_OFF_T % 2147483647 == 1)<br>                    ? 1 : -1];<br>@@ -14731,7 +14720,7 @@<br>     We can't simply define LARGE_OFF_T to be 9223372036854775807,<br>     since some C++ compilers masquerading as C compilers<br>     incorrectly reject 9223372036854775807.  */<br>-#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))<br>+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))<br>   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721<br>                       && LARGE_OFF_T % 2147483647 == 1)<br>                    ? 1 : -1];<br>@@ -14755,7 +14744,7 @@<br>     We can't simply define LARGE_OFF_T to be 9223372036854775807,<br>     since some C++ compilers masquerading as C compilers<br>     incorrectly reject 9223372036854775807.  */<br>-#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))<br>+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))<br>   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721<br>                       && LARGE_OFF_T % 2147483647 == 1)<br>                    ? 1 : -1];<br>@@ -14800,7 +14789,7 @@<br>     We can't simply define LARGE_OFF_T to be 9223372036854775807,<br>     since some C++ compilers masquerading as C compilers<br>     incorrectly reject 9223372036854775807.  */<br>-#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))<br>+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))<br>   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721<br>                       && LARGE_OFF_T % 2147483647 == 1)<br>                    ? 1 : -1];<br>@@ -14824,7 +14813,7 @@<br>     We can't simply define LARGE_OFF_T to be 9223372036854775807,<br>     since some C++ compilers masquerading as C compilers<br>     incorrectly reject 9223372036854775807.  */<br>-#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))<br>+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))<br>   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721<br>                       && LARGE_OFF_T % 2147483647 == 1)<br>                    ? 1 : -1];<br>@@ -18842,6 +18831,19 @@<br> fi<br> <br> <br>+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -Wno-format-truncation" >&5<br>+$as_echo_n "checking for -Wno-format-truncation... " >&6; }<br>+if $(${CC} -O2 -Wno-format-truncation -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then<br>+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5<br>+$as_echo "yes" >&6; }<br>+  AST_NO_FORMAT_TRUNCATION=-Wno-format-truncation<br>+else<br>+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5<br>+$as_echo "no" >&6; }<br>+    AST_NO_FORMAT_TRUNCATION=<br>+fi<br>+<br>+<br> { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -Wshadow" >&5<br> $as_echo_n "checking for -Wshadow... " >&6; }<br> if $(${CC} -Wshadow -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then<br>diff --git a/configure.ac b/configure.ac<br>index f40403e..ced52c4 100644<br>--- a/configure.ac<br>+++ b/configure.ac<br>@@ -1225,6 +1225,16 @@<br> fi<br> AC_SUBST(AST_NO_STRICT_OVERFLOW)<br> <br>+AC_MSG_CHECKING(for -Wno-format-truncation)<br>+if $(${CC} -O2 -Wno-format-truncation -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then<br>+ AC_MSG_RESULT(yes)<br>+   AST_NO_FORMAT_TRUNCATION=-Wno-format-truncation<br>+else<br>+       AC_MSG_RESULT(no)<br>+    AST_NO_FORMAT_TRUNCATION=<br>+fi<br>+AC_SUBST(AST_NO_FORMAT_TRUNCATION)<br>+<br> AC_MSG_CHECKING(for -Wshadow)<br> if $(${CC} -Wshadow -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then<br>  AC_MSG_RESULT(yes)<br>diff --git a/main/Makefile b/main/Makefile<br>index 2521585..18f1025 100644<br>--- a/main/Makefile<br>+++ b/main/Makefile<br>@@ -140,7 +140,7 @@<br>  $(CMD_PREFIX) rm $@.fix<br> <br> ast_expr2f.o: _ASTCFLAGS+=-Wno-unused<br>-cdr.o: _ASTCFLAGS+=-Wno-format-truncation<br>+cdr.o: _ASTCFLAGS+=$(AST_NO_FORMAT_TRUNCATION)<br> <br> testexpr2: ast_expr2f.c ast_expr2.c ast_expr2.h<br>  $(CC) -g -c -Iinclude -DSTANDALONE ast_expr2f.c<br>diff --git a/makeopts.in b/makeopts.in<br>index 8f83ed9..c615a4a 100644<br>--- a/makeopts.in<br>+++ b/makeopts.in<br>@@ -116,6 +116,7 @@<br> AST_DECLARATION_AFTER_STATEMENT=@AST_DECLARATION_AFTER_STATEMENT@<br> AST_TRAMPOLINES=@AST_TRAMPOLINES@<br> AST_NO_STRICT_OVERFLOW=@AST_NO_STRICT_OVERFLOW@<br>+AST_NO_FORMAT_TRUNCATION=@AST_NO_FORMAT_TRUNCATION@<br> AST_SHADOW_WARNINGS=@AST_SHADOW_WARNINGS@<br> AST_NESTED_FUNCTIONS=@AST_NESTED_FUNCTIONS@<br> AST_CLANG_BLOCKS=@AST_CLANG_BLOCKS@<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/6130">change 6130</a>. To unsubscribe, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/6130"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 13 </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: Iac0aed7a5bcaa16c21b7d62c4e4678d244c4ccb6 </div>
<div style="display:none"> Gerrit-Change-Number: 6130 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Corey Farrell <git@cfware.com> </div>