<p>Joshua Colp <strong>merged</strong> this change.</p><p><a href="https://gerrit.asterisk.org/6128">View Change</a></p><div style="white-space:pre-wrap">Approvals:
  George Joseph: Looks good to me, but someone else must approve
  Joshua Colp: Looks good to me, approved; Approved for Submit

</div><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;">diff --git a/apps/Makefile b/apps/Makefile<br>index d688173..d7f755f 100644<br>--- a/apps/Makefile<br>+++ b/apps/Makefile<br>@@ -29,7 +29,7 @@<br> <br> $(call MOD_ADD_C,app_confbridge,$(wildcard confbridge/*.c))<br> <br>-app_voicemail.o: _ASTCFLAGS+=-Wno-format-truncation<br>+app_voicemail.o: _ASTCFLAGS+=$(AST_NO_FORMAT_TRUNCATION)<br> <br> ifneq ($(findstring $(OSARCH), mingw32 cygwin ),)<br>   LIBS+= -lres_ael_share.so -lres_monitor.so -lres_speech.so<br>diff --git a/channels/Makefile b/channels/Makefile<br>index ae7107f..242d3f4 100644<br>--- a/channels/Makefile<br>+++ b/channels/Makefile<br>@@ -29,7 +29,7 @@<br> $(call MOD_ADD_C,chan_dahdi,$(wildcard dahdi/*.c) sig_analog.c sig_pri.c sig_ss7.c)<br> $(call MOD_ADD_C,chan_misdn,misdn_config.c misdn/isdn_lib.c misdn/isdn_msg_parser.c)<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> misdn_config.o: _ASTCFLAGS+=-Imisdn<br>diff --git a/configure b/configure<br>index 5bb7523..9bbff76 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>@@ -1356,7 +1357,6 @@<br> docdir<br> oldincludedir<br> includedir<br>-runstatedir<br> localstatedir<br> sharedstatedir<br> sysconfdir<br>@@ -1541,7 +1541,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>@@ -1794,15 +1793,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>@@ -1940,7 +1930,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>@@ -2093,7 +2083,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>@@ -14927,7 +14916,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>@@ -14973,7 +14962,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>@@ -14997,7 +14986,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>@@ -15042,7 +15031,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>@@ -15066,7 +15055,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>@@ -19069,6 +19058,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 a2eaab4..32b5fc0 100644<br>--- a/configure.ac<br>+++ b/configure.ac<br>@@ -1252,6 +1252,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 d816443..e64aace 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 07360a7..887a155 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/6128">change 6128</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/6128"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 15 </div>
<div style="display:none"> Gerrit-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: Iac0aed7a5bcaa16c21b7d62c4e4678d244c4ccb6 </div>
<div style="display:none"> Gerrit-Change-Number: 6128 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Corey Farrell <git@cfware.com> </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins2 </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@digium.com> </div>