[jira] [Issue Comment Edited] (TS-1091) `./configure CFLAGS=-w` causes configure script to wrongly guess style of `gethostbyname_r` on OS X (and probably other BSDs)

2012-01-23 Thread Marc Abramowitz (Issue Comment Edited) (JIRA)

[ 
https://issues.apache.org/jira/browse/TS-1091?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13191267#comment-13191267
 ] 

Marc Abramowitz edited comment on TS-1091 at 1/23/12 5:41 PM:
--

Hey Leif,

Yeah I really wanted to get it into a single regex, but it escaped me. The 
tricky part is handling -w at the beginning or end of CFLAGS. My instinct was 
to use "\b-w\b" but I don't think we can rely on sed (especially non-GNU sed) 
to support \b. Your regex looks like it will work though:

{code}
marca@SCML-MarcA:~/src/trafficserver-3.0.2$ echo "-Wall -Werror -w -O3" | sed 
's/ *-w */ /g'
-Wall -Werror -O3
marca@SCML-MarcA:~/src/trafficserver-3.0.2$ echo "-Wall -Werror -O3 -w" | sed 
's/ *-w */ /g'
-Wall -Werror -O3 
marca@SCML-MarcA:~/src/trafficserver-3.0.2$ echo "-w -Wall -Werror -O3" | sed 
's/ *-w */ /g'
 -Wall -Werror -O3
{code}

except here's one (contrived) case that fails:

{code}
marca@SCML-MarcA:~/src/trafficserver-3.0.2$ echo "-Wall -fake-option-w -Werror 
-O3" | sed 's/ *-w */ /g'
-Wall -fake-option -Werror -O3
{code}


  was (Author: msabramo):
Hey Leif,

Yeah I really wanted to get it into a single regex, but it escaped me. The 
tricky part is handling -w at the beginning or end of CFLAGS. My instinct was 
to use "\b-w\b" but I don't think we can rely on sed (especially non-GNU sed) 
to support \b. Your regex looks like it will work though:

{code}
marca@SCML-MarcA:~/src/trafficserver-3.0.2$ echo "-Wall -Werror -w -O3" | sed 
's/ *-w */ /g'
-Wall -Werror -O3
marca@SCML-MarcA:~/src/trafficserver-3.0.2$ echo "-Wall -Werror -O3 -w" | sed 
's/ *-w */ /g'
-Wall -Werror -O3 
marca@SCML-MarcA:~/src/trafficserver-3.0.2$ echo "-w -Wall -Werror -O3" | sed 
's/ *-w */ /g'
 -Wall -Werror -O3
{code}

except here's one (contrived) case that fails:

{code}
marca@SCML-MarcA:~/src/trafficserver-3.0.2$ echo "-Wall -fake-option-w -Werror 
-O3" | sed 's/ *-w */ /g'
-Wall -fake-option -Werror -O3
{code}

I don't know if there are any gcc options that actually end in "-w" though. :-)

  
> `./configure CFLAGS=-w` causes configure script to wrongly guess style of 
> `gethostbyname_r` on OS X (and probably other BSDs)
> -
>
> Key: TS-1091
> URL: https://issues.apache.org/jira/browse/TS-1091
> Project: Traffic Server
>  Issue Type: Bug
>  Components: Build
>Affects Versions: 3.0.2
> Environment: OS X 10.6.8
>Reporter: Marc Abramowitz
>Priority: Minor
>  Labels: autoconf, build, configure
>   Original Estimate: 10m
>  Remaining Estimate: 10m
>
> {code}
> marca@SCML-MarcA:~/src/trafficserver-3.0.2$ system_profiler -detailLevel mini 
> | grep 'System Version'
>   System Version: Mac OS X 10.6.8 (10K549)
> marca@SCML-MarcA:~/src/trafficserver-3.0.2$ ./configure CFLAGS=-w
> ...
> checking style of gethostbyname_r routine... glibc2
> checking 3rd argument to the gethostbyname_r routines... hostent_data
> configure: Build using CC=gcc
> configure: Build using CXX=g++
> configure: Build using CPP=gcc -E
> configure: Build using CFLAGS=-w -g -pipe -Wall -Werror -O3 
> -feliminate-unused-debug-symbols -fno-strict-aliasing
> ...
> marca@SCML-MarcA:~/src/trafficserver-3.0.2$ grep gethostbyname_r Makefile
> gethostbyname_r_glibc2 = 1
> gethostbyname_r_hostent_data = 1
> marca@SCML-MarcA:~/src/trafficserver-3.0.2$ make
> ...
> ink_inet.cc: In function 'hostent* ink_gethostbyaddr_r(char*, int, int, 
> ink_gethostbyaddr_r_data*)':
> ink_inet.cc:73: error: cannot convert 'hostent**' to 'int*' for argument '7' 
> to 'hostent* gethostbyaddr_r(const char*, size_t, int, hostent*, char*, int, 
> int*)'
> make[3]: *** [ink_inet.lo] Error 1
> make[2]: *** [all] Error 2
> make[1]: *** [all-recursive] Error 1
> make: *** [all-recursive] Error 1
> {code}
> Arguably, people should never run configure with CFLAGS=-w and this might 
> seem stupid and something that should never happen, but it turns out that 
> Homebrew (http://mxcl.github.com/homebrew/) does this by default 
> (https://github.com/mxcl/homebrew/issues/9728) -- I discovered this while 
> writing a Homebrew formula for Traffic Server 
> (https://github.com/mxcl/homebrew/pull/9513). After discovering that this was 
> causing problems, I modified my formula to tell Homebrew not to do this and 
> all is well, but I thought it would be interesting to make Traffic Server 
> resistant to this as well.
> I first tried to enable warnings by trying to find a gcc #pragma that could 
> go in the conftest.c code 
> (http://gcc.gnu.org/onlinedocs/gcc/Diagnostic-Pragmas.html looked promising 
> but I could not find one that worked), but I could not find any #pragma that 
> seemed to do this.
> I ended up making a small 

[jira] [Issue Comment Edited] (TS-1091) `./configure CFLAGS=-w` causes configure script to wrongly guess style of `gethostbyname_r` on OS X (and probably other BSDs)

2012-01-23 Thread Marc Abramowitz (Issue Comment Edited) (JIRA)

[ 
https://issues.apache.org/jira/browse/TS-1091?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13191273#comment-13191273
 ] 

Marc Abramowitz edited comment on TS-1091 at 1/23/12 5:40 PM:
--

Here's an actual possible case that fails:

{code}
marca@SCML-MarcA:~/src/trafficserver-3.0.2$ echo "-Wall -mno-wide-multiply 
-Werror -O3" | sed 's/ *-w */ /g'
-Wall -mno ide-multiply -Werror -O3
marca@SCML-MarcA:~/src/trafficserver-3.0.2$ echo "-Wall -mno-wide-multiply 
-Werror -O3" | sed -e 's/^-w$//' -e 's/^-w //' -e 's/ -w$//' -e 's/ -w / /'
-Wall -mno-wide-multiply -Werror -O3
{code}

Some problematic options that have -w in them:

{code}
   -fno-weak
   -whyload
   -weak_reference_mismatches 
   -whatsloaded
   -mno-wide-multiply
   -fshort-wchar
   -x assembler-with-cpp
{code}

These get battered by the simpler regex:

{code}
marca@SCML-MarcA:~/src/trafficserver-3.0.2$ echo "-Wall -fno-weak -Werror -O3" 
| sed 's/ *-w */ /g'
-Wall -fno eak -Werror -O3
marca@SCML-MarcA:~/src/trafficserver-3.0.2$ echo "-Wall -whyload -Werror -O3" | 
sed 's/ *-w */ /g'
-Wall hyload -Werror -O3
marca@SCML-MarcA:~/src/trafficserver-3.0.2$ echo "-Wall -whatsloaded -Werror 
-O3" | sed 's/ *-w */ /g'
-Wall hatsloaded -Werror -O3
marca@SCML-MarcA:~/src/trafficserver-3.0.2$ echo "-Wall -fshort-wchar -Werror 
-O3" | sed 's/ *-w */ /g'
-Wall -fshort char -Werror -O3
{code}

  was (Author: msabramo):
Here's an actual possible case that fails:

{code}
marca@SCML-MarcA:~/src/trafficserver-3.0.2$ echo "-Wall -mno-wide-multiply 
-Werror -O3" | sed 's/ *-w */ /g'
-Wall -mno ide-multiply -Werror -O3
marca@SCML-MarcA:~/src/trafficserver-3.0.2$ echo "-Wall -mno-wide-multiply 
-Werror -O3" | sed -e 's/^-w$//' -e 's/^-w //' -e 's/ -w$//' -e 's/ -w / /'
-Wall -mno-wide-multiply -Werror -O3
{code}

Some problematic options that have -w in them:

   -fno-weak
   -whyload
   -weak_reference_mismatches 
   -whatsloaded
   -mno-wide-multiply
   -fshort-wchar
   -x assembler-with-cpp

  
> `./configure CFLAGS=-w` causes configure script to wrongly guess style of 
> `gethostbyname_r` on OS X (and probably other BSDs)
> -
>
> Key: TS-1091
> URL: https://issues.apache.org/jira/browse/TS-1091
> Project: Traffic Server
>  Issue Type: Bug
>  Components: Build
>Affects Versions: 3.0.2
> Environment: OS X 10.6.8
>Reporter: Marc Abramowitz
>Priority: Minor
>  Labels: autoconf, build, configure
>   Original Estimate: 10m
>  Remaining Estimate: 10m
>
> {code}
> marca@SCML-MarcA:~/src/trafficserver-3.0.2$ system_profiler -detailLevel mini 
> | grep 'System Version'
>   System Version: Mac OS X 10.6.8 (10K549)
> marca@SCML-MarcA:~/src/trafficserver-3.0.2$ ./configure CFLAGS=-w
> ...
> checking style of gethostbyname_r routine... glibc2
> checking 3rd argument to the gethostbyname_r routines... hostent_data
> configure: Build using CC=gcc
> configure: Build using CXX=g++
> configure: Build using CPP=gcc -E
> configure: Build using CFLAGS=-w -g -pipe -Wall -Werror -O3 
> -feliminate-unused-debug-symbols -fno-strict-aliasing
> ...
> marca@SCML-MarcA:~/src/trafficserver-3.0.2$ grep gethostbyname_r Makefile
> gethostbyname_r_glibc2 = 1
> gethostbyname_r_hostent_data = 1
> marca@SCML-MarcA:~/src/trafficserver-3.0.2$ make
> ...
> ink_inet.cc: In function 'hostent* ink_gethostbyaddr_r(char*, int, int, 
> ink_gethostbyaddr_r_data*)':
> ink_inet.cc:73: error: cannot convert 'hostent**' to 'int*' for argument '7' 
> to 'hostent* gethostbyaddr_r(const char*, size_t, int, hostent*, char*, int, 
> int*)'
> make[3]: *** [ink_inet.lo] Error 1
> make[2]: *** [all] Error 2
> make[1]: *** [all-recursive] Error 1
> make: *** [all-recursive] Error 1
> {code}
> Arguably, people should never run configure with CFLAGS=-w and this might 
> seem stupid and something that should never happen, but it turns out that 
> Homebrew (http://mxcl.github.com/homebrew/) does this by default 
> (https://github.com/mxcl/homebrew/issues/9728) -- I discovered this while 
> writing a Homebrew formula for Traffic Server 
> (https://github.com/mxcl/homebrew/pull/9513). After discovering that this was 
> causing problems, I modified my formula to tell Homebrew not to do this and 
> all is well, but I thought it would be interesting to make Traffic Server 
> resistant to this as well.
> I first tried to enable warnings by trying to find a gcc #pragma that could 
> go in the conftest.c code 
> (http://gcc.gnu.org/onlinedocs/gcc/Diagnostic-Pragmas.html looked promising 
> but I could not find one that worked), but I could not find 

[jira] [Issue Comment Edited] (TS-1091) `./configure CFLAGS=-w` causes configure script to wrongly guess style of `gethostbyname_r` on OS X (and probably other BSDs)

2012-01-23 Thread Marc Abramowitz (Issue Comment Edited) (JIRA)

[ 
https://issues.apache.org/jira/browse/TS-1091?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13191273#comment-13191273
 ] 

Marc Abramowitz edited comment on TS-1091 at 1/23/12 5:41 PM:
--

Here's an actual possible case that fails:

{code}
marca@SCML-MarcA:~/src/trafficserver-3.0.2$ echo "-Wall -mno-wide-multiply 
-Werror -O3" | sed 's/ *-w */ /g'
-Wall -mno ide-multiply -Werror -O3
marca@SCML-MarcA:~/src/trafficserver-3.0.2$ echo "-Wall -mno-wide-multiply 
-Werror -O3" | sed -e 's/^-w$//' -e 's/^-w //' -e 's/ -w$//' -e 's/ -w / /'
-Wall -mno-wide-multiply -Werror -O3
{code}

Some problematic options that have -w in them:

{code}
-fno-weak
-whyload
-weak_reference_mismatches 
-whatsloaded
-mno-wide-multiply
-fshort-wchar
-x assembler-with-cpp
{code}

These get battered by the simpler regex:

{code}
marca@SCML-MarcA:~/src/trafficserver-3.0.2$ echo "-Wall -fno-weak -Werror -O3" 
| sed 's/ *-w */ /g'
-Wall -fno eak -Werror -O3
marca@SCML-MarcA:~/src/trafficserver-3.0.2$ echo "-Wall -whyload -Werror -O3" | 
sed 's/ *-w */ /g'
-Wall hyload -Werror -O3
marca@SCML-MarcA:~/src/trafficserver-3.0.2$ echo "-Wall -whatsloaded -Werror 
-O3" | sed 's/ *-w */ /g'
-Wall hatsloaded -Werror -O3
marca@SCML-MarcA:~/src/trafficserver-3.0.2$ echo "-Wall -fshort-wchar -Werror 
-O3" | sed 's/ *-w */ /g'
-Wall -fshort char -Werror -O3
{code}

  was (Author: msabramo):
Here's an actual possible case that fails:

{code}
marca@SCML-MarcA:~/src/trafficserver-3.0.2$ echo "-Wall -mno-wide-multiply 
-Werror -O3" | sed 's/ *-w */ /g'
-Wall -mno ide-multiply -Werror -O3
marca@SCML-MarcA:~/src/trafficserver-3.0.2$ echo "-Wall -mno-wide-multiply 
-Werror -O3" | sed -e 's/^-w$//' -e 's/^-w //' -e 's/ -w$//' -e 's/ -w / /'
-Wall -mno-wide-multiply -Werror -O3
{code}

Some problematic options that have -w in them:

{code}
   -fno-weak
   -whyload
   -weak_reference_mismatches 
   -whatsloaded
   -mno-wide-multiply
   -fshort-wchar
   -x assembler-with-cpp
{code}

These get battered by the simpler regex:

{code}
marca@SCML-MarcA:~/src/trafficserver-3.0.2$ echo "-Wall -fno-weak -Werror -O3" 
| sed 's/ *-w */ /g'
-Wall -fno eak -Werror -O3
marca@SCML-MarcA:~/src/trafficserver-3.0.2$ echo "-Wall -whyload -Werror -O3" | 
sed 's/ *-w */ /g'
-Wall hyload -Werror -O3
marca@SCML-MarcA:~/src/trafficserver-3.0.2$ echo "-Wall -whatsloaded -Werror 
-O3" | sed 's/ *-w */ /g'
-Wall hatsloaded -Werror -O3
marca@SCML-MarcA:~/src/trafficserver-3.0.2$ echo "-Wall -fshort-wchar -Werror 
-O3" | sed 's/ *-w */ /g'
-Wall -fshort char -Werror -O3
{code}
  
> `./configure CFLAGS=-w` causes configure script to wrongly guess style of 
> `gethostbyname_r` on OS X (and probably other BSDs)
> -
>
> Key: TS-1091
> URL: https://issues.apache.org/jira/browse/TS-1091
> Project: Traffic Server
>  Issue Type: Bug
>  Components: Build
>Affects Versions: 3.0.2
> Environment: OS X 10.6.8
>Reporter: Marc Abramowitz
>Priority: Minor
>  Labels: autoconf, build, configure
>   Original Estimate: 10m
>  Remaining Estimate: 10m
>
> {code}
> marca@SCML-MarcA:~/src/trafficserver-3.0.2$ system_profiler -detailLevel mini 
> | grep 'System Version'
>   System Version: Mac OS X 10.6.8 (10K549)
> marca@SCML-MarcA:~/src/trafficserver-3.0.2$ ./configure CFLAGS=-w
> ...
> checking style of gethostbyname_r routine... glibc2
> checking 3rd argument to the gethostbyname_r routines... hostent_data
> configure: Build using CC=gcc
> configure: Build using CXX=g++
> configure: Build using CPP=gcc -E
> configure: Build using CFLAGS=-w -g -pipe -Wall -Werror -O3 
> -feliminate-unused-debug-symbols -fno-strict-aliasing
> ...
> marca@SCML-MarcA:~/src/trafficserver-3.0.2$ grep gethostbyname_r Makefile
> gethostbyname_r_glibc2 = 1
> gethostbyname_r_hostent_data = 1
> marca@SCML-MarcA:~/src/trafficserver-3.0.2$ make
> ...
> ink_inet.cc: In function 'hostent* ink_gethostbyaddr_r(char*, int, int, 
> ink_gethostbyaddr_r_data*)':
> ink_inet.cc:73: error: cannot convert 'hostent**' to 'int*' for argument '7' 
> to 'hostent* gethostbyaddr_r(const char*, size_t, int, hostent*, char*, int, 
> int*)'
> make[3]: *** [ink_inet.lo] Error 1
> make[2]: *** [all] Error 2
> make[1]: *** [all-recursive] Error 1
> make: *** [all-recursive] Error 1
> {code}
> Arguably, people should never run configure with CFLAGS=-w and this might 
> seem stupid and something that should never happen, but it turns out that 
> Homebrew (http://mxcl.github.com/homebrew/) does this by default 
> (https://github.com/mxcl/homebrew/issues/9728) -- I discovered this while 
> writing a Homebrew formula for Traffic Server 

[jira] [Issue Comment Edited] (TS-1091) `./configure CFLAGS=-w` causes configure script to wrongly guess style of `gethostbyname_r` on OS X (and probably other BSDs)

2012-01-23 Thread Marc Abramowitz (Issue Comment Edited) (JIRA)

[ 
https://issues.apache.org/jira/browse/TS-1091?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13191273#comment-13191273
 ] 

Marc Abramowitz edited comment on TS-1091 at 1/23/12 5:37 PM:
--

Here's an actual possible case that fails:

{code}
marca@SCML-MarcA:~/src/trafficserver-3.0.2$ echo "-Wall -mno-wide-multiply 
-Werror -O3" | sed 's/ *-w */ /g'
-Wall -mno ide-multiply -Werror -O3
marca@SCML-MarcA:~/src/trafficserver-3.0.2$ echo "-Wall -mno-wide-multiply 
-Werror -O3" | sed -e 's/^-w$//' -e 's/^-w //' -e 's/ -w$//' -e 's/ -w / /'
-Wall -mno-wide-multiply -Werror -O3
{code}

Some problematic options that have -w in them:

   -fno-weak
   -whyload
   -weak_reference_mismatches 
   -whatsloaded
   -mno-wide-multiply
   -fshort-wchar
   -x assembler-with-cpp


  was (Author: msabramo):
Here's an actual possible case that fails:

{code}
marca@SCML-MarcA:~/src/trafficserver-3.0.2$ echo "-Wall -mno-wide-multiply 
-Werror -O3" | sed 's/ *-w */ /g'
-Wall -mno ide-multiply -Werror -O3
marca@SCML-MarcA:~/src/trafficserver-3.0.2$ echo "-Wall -mno-wide-multiply 
-Werror -O3" | sed -e 's/^-w$//' -e 's/^-w //' -e 's/ -w$//' -e 's/ -w / /'
-Wall -mno-wide-multiply -Werror -O3
{code}
  
> `./configure CFLAGS=-w` causes configure script to wrongly guess style of 
> `gethostbyname_r` on OS X (and probably other BSDs)
> -
>
> Key: TS-1091
> URL: https://issues.apache.org/jira/browse/TS-1091
> Project: Traffic Server
>  Issue Type: Bug
>  Components: Build
>Affects Versions: 3.0.2
> Environment: OS X 10.6.8
>Reporter: Marc Abramowitz
>Priority: Minor
>  Labels: autoconf, build, configure
>   Original Estimate: 10m
>  Remaining Estimate: 10m
>
> {code}
> marca@SCML-MarcA:~/src/trafficserver-3.0.2$ system_profiler -detailLevel mini 
> | grep 'System Version'
>   System Version: Mac OS X 10.6.8 (10K549)
> marca@SCML-MarcA:~/src/trafficserver-3.0.2$ ./configure CFLAGS=-w
> ...
> checking style of gethostbyname_r routine... glibc2
> checking 3rd argument to the gethostbyname_r routines... hostent_data
> configure: Build using CC=gcc
> configure: Build using CXX=g++
> configure: Build using CPP=gcc -E
> configure: Build using CFLAGS=-w -g -pipe -Wall -Werror -O3 
> -feliminate-unused-debug-symbols -fno-strict-aliasing
> ...
> marca@SCML-MarcA:~/src/trafficserver-3.0.2$ grep gethostbyname_r Makefile
> gethostbyname_r_glibc2 = 1
> gethostbyname_r_hostent_data = 1
> marca@SCML-MarcA:~/src/trafficserver-3.0.2$ make
> ...
> ink_inet.cc: In function 'hostent* ink_gethostbyaddr_r(char*, int, int, 
> ink_gethostbyaddr_r_data*)':
> ink_inet.cc:73: error: cannot convert 'hostent**' to 'int*' for argument '7' 
> to 'hostent* gethostbyaddr_r(const char*, size_t, int, hostent*, char*, int, 
> int*)'
> make[3]: *** [ink_inet.lo] Error 1
> make[2]: *** [all] Error 2
> make[1]: *** [all-recursive] Error 1
> make: *** [all-recursive] Error 1
> {code}
> Arguably, people should never run configure with CFLAGS=-w and this might 
> seem stupid and something that should never happen, but it turns out that 
> Homebrew (http://mxcl.github.com/homebrew/) does this by default 
> (https://github.com/mxcl/homebrew/issues/9728) -- I discovered this while 
> writing a Homebrew formula for Traffic Server 
> (https://github.com/mxcl/homebrew/pull/9513). After discovering that this was 
> causing problems, I modified my formula to tell Homebrew not to do this and 
> all is well, but I thought it would be interesting to make Traffic Server 
> resistant to this as well.
> I first tried to enable warnings by trying to find a gcc #pragma that could 
> go in the conftest.c code 
> (http://gcc.gnu.org/onlinedocs/gcc/Diagnostic-Pragmas.html looked promising 
> but I could not find one that worked), but I could not find any #pragma that 
> seemed to do this.
> I ended up making a small change to `build/common.m4` that strips -w out of 
> CFLAGS using `sed`.
> {code}
> --- build/common.m4.2012-01-22-092051 2011-05-25 13:19:54.0 -0700
> +++ build/common.m4   2012-01-22 22:48:14.0 -0800
> @@ -177,6 +177,7 @@
>   if test "$ac_cv_prog_gcc" = "yes"; then
> CFLAGS="$CFLAGS -Werror"
>   fi
> + CFLAGS=$(echo $CFLAGS | sed -e 's/^-w$//' -e 's/^-w //' -e 's/ -w$//' -e 
> 's/ -w / /')
>   AC_COMPILE_IFELSE([AC_LANG_SOURCE([
>[#include "confdefs.h"
>]
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/so

[jira] [Issue Comment Edited] (TS-1091) `./configure CFLAGS=-w` causes configure script to wrongly guess style of `gethostbyname_r` on OS X (and probably other BSDs)

2012-01-23 Thread Marc Abramowitz (Issue Comment Edited) (JIRA)

[ 
https://issues.apache.org/jira/browse/TS-1091?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13191273#comment-13191273
 ] 

Marc Abramowitz edited comment on TS-1091 at 1/23/12 5:27 PM:
--

Here's an actual possible case that fails:

{code}
marca@SCML-MarcA:~/src/trafficserver-3.0.2$ echo "-Wall -mno-wide-multiply 
-Werror -O3" | sed 's/ *-w */ /g'
-Wall -mno ide-multiply -Werror -O3
marca@SCML-MarcA:~/src/trafficserver-3.0.2$ echo "-Wall -mno-wide-multiply 
-Werror -O3" | sed -e 's/^-w$//' -e 's/^-w //' -e 's/ -w$//' -e 's/ -w / /'
-Wall -mno-wide-multiply -Werror -O3
{code}

  was (Author: msabramo):
Here's an actual possible case that fails:

{code}
marca@SCML-MarcA:~/src/trafficserver-3.0.2$ echo "-Wall -mno-wide-multiply 
-Werror -O3" | sed 's/ *-w */ /g'
-Wall -mno ide-multiply -Werror -O3
{code}
  
> `./configure CFLAGS=-w` causes configure script to wrongly guess style of 
> `gethostbyname_r` on OS X (and probably other BSDs)
> -
>
> Key: TS-1091
> URL: https://issues.apache.org/jira/browse/TS-1091
> Project: Traffic Server
>  Issue Type: Bug
>  Components: Build
>Affects Versions: 3.0.2
> Environment: OS X 10.6.8
>Reporter: Marc Abramowitz
>Priority: Minor
>  Labels: autoconf, build, configure
>   Original Estimate: 10m
>  Remaining Estimate: 10m
>
> {code}
> marca@SCML-MarcA:~/src/trafficserver-3.0.2$ system_profiler -detailLevel mini 
> | grep 'System Version'
>   System Version: Mac OS X 10.6.8 (10K549)
> marca@SCML-MarcA:~/src/trafficserver-3.0.2$ ./configure CFLAGS=-w
> ...
> checking style of gethostbyname_r routine... glibc2
> checking 3rd argument to the gethostbyname_r routines... hostent_data
> configure: Build using CC=gcc
> configure: Build using CXX=g++
> configure: Build using CPP=gcc -E
> configure: Build using CFLAGS=-w -g -pipe -Wall -Werror -O3 
> -feliminate-unused-debug-symbols -fno-strict-aliasing
> ...
> marca@SCML-MarcA:~/src/trafficserver-3.0.2$ grep gethostbyname_r Makefile
> gethostbyname_r_glibc2 = 1
> gethostbyname_r_hostent_data = 1
> marca@SCML-MarcA:~/src/trafficserver-3.0.2$ make
> ...
> ink_inet.cc: In function 'hostent* ink_gethostbyaddr_r(char*, int, int, 
> ink_gethostbyaddr_r_data*)':
> ink_inet.cc:73: error: cannot convert 'hostent**' to 'int*' for argument '7' 
> to 'hostent* gethostbyaddr_r(const char*, size_t, int, hostent*, char*, int, 
> int*)'
> make[3]: *** [ink_inet.lo] Error 1
> make[2]: *** [all] Error 2
> make[1]: *** [all-recursive] Error 1
> make: *** [all-recursive] Error 1
> {code}
> Arguably, people should never run configure with CFLAGS=-w and this might 
> seem stupid and something that should never happen, but it turns out that 
> Homebrew (http://mxcl.github.com/homebrew/) does this by default 
> (https://github.com/mxcl/homebrew/issues/9728) -- I discovered this while 
> writing a Homebrew formula for Traffic Server 
> (https://github.com/mxcl/homebrew/pull/9513). After discovering that this was 
> causing problems, I modified my formula to tell Homebrew not to do this and 
> all is well, but I thought it would be interesting to make Traffic Server 
> resistant to this as well.
> I first tried to enable warnings by trying to find a gcc #pragma that could 
> go in the conftest.c code 
> (http://gcc.gnu.org/onlinedocs/gcc/Diagnostic-Pragmas.html looked promising 
> but I could not find one that worked), but I could not find any #pragma that 
> seemed to do this.
> I ended up making a small change to `build/common.m4` that strips -w out of 
> CFLAGS using `sed`.
> {code}
> --- build/common.m4.2012-01-22-092051 2011-05-25 13:19:54.0 -0700
> +++ build/common.m4   2012-01-22 22:48:14.0 -0800
> @@ -177,6 +177,7 @@
>   if test "$ac_cv_prog_gcc" = "yes"; then
> CFLAGS="$CFLAGS -Werror"
>   fi
> + CFLAGS=$(echo $CFLAGS | sed -e 's/^-w$//' -e 's/^-w //' -e 's/ -w$//' -e 
> 's/ -w / /')
>   AC_COMPILE_IFELSE([AC_LANG_SOURCE([
>[#include "confdefs.h"
>]
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira




[jira] [Issue Comment Edited] (TS-1091) `./configure CFLAGS=-w` causes configure script to wrongly guess style of `gethostbyname_r` on OS X (and probably other BSDs)

2012-01-23 Thread Marc Abramowitz (Issue Comment Edited) (JIRA)

[ 
https://issues.apache.org/jira/browse/TS-1091?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13191267#comment-13191267
 ] 

Marc Abramowitz edited comment on TS-1091 at 1/23/12 5:24 PM:
--

Hey Leif,

Yeah I really wanted to get it into a single regex, but it escaped me. The 
tricky part is handling -w at the beginning or end of CFLAGS. My instinct was 
to use "\b-w\b" but I don't think we can rely on sed (especially non-GNU sed) 
to support \b. Your regex looks like it will work though:

{code}
marca@SCML-MarcA:~/src/trafficserver-3.0.2$ echo "-Wall -Werror -w -O3" | sed 
's/ *-w */ /g'
-Wall -Werror -O3
marca@SCML-MarcA:~/src/trafficserver-3.0.2$ echo "-Wall -Werror -O3 -w" | sed 
's/ *-w */ /g'
-Wall -Werror -O3 
marca@SCML-MarcA:~/src/trafficserver-3.0.2$ echo "-w -Wall -Werror -O3" | sed 
's/ *-w */ /g'
 -Wall -Werror -O3
{code}

except here's one (contrived) case that fails:

{code}
marca@SCML-MarcA:~/src/trafficserver-3.0.2$ echo "-Wall -fake-option-w -Werror 
-O3" | sed 's/ *-w */ /g'
-Wall -fake-option -Werror -O3
{code}

I don't know if there are any gcc options that actually end in "-w" though. :-)


  was (Author: msabramo):
Hey Leif,

Yeah I really wanted to get it into a single regex, but it escaped me. The 
tricky part is handling -w at the beginning or end of CFLAGS. My instinct was 
to use "\b-w\b" but I don't think we can rely on sed (especially non-GNU sed) 
to support \b. Your regex looks like it will work though:

{code}
marca@SCML-MarcA:~/src/trafficserver-3.0.2$ echo "-Wall -Werror -w -O3" | sed 
's/ *-w */ /g'
-Wall -Werror -O3
marca@SCML-MarcA:~/src/trafficserver-3.0.2$ echo "-Wall -Werror -O3 -w" | sed 
's/ *-w */ /g'
-Wall -Werror -O3 
marca@SCML-MarcA:~/src/trafficserver-3.0.2$ echo "-w -Wall -Werror -O3" | sed 
's/ *-w */ /g'
 -Wall -Werror -O3
{code}

except here's one fake case that fails:

{code}
marca@SCML-MarcA:~/src/trafficserver-3.0.2$ echo "-Wall -fake-option-w -Werror 
-O3" | sed 's/ *-w */ /g'
-Wall -fake-option -Werror -O3
{code}

I don't know if there are any gcc options that actually end in "-w" though. :-)

  
> `./configure CFLAGS=-w` causes configure script to wrongly guess style of 
> `gethostbyname_r` on OS X (and probably other BSDs)
> -
>
> Key: TS-1091
> URL: https://issues.apache.org/jira/browse/TS-1091
> Project: Traffic Server
>  Issue Type: Bug
>  Components: Build
>Affects Versions: 3.0.2
> Environment: OS X 10.6.8
>Reporter: Marc Abramowitz
>Priority: Minor
>  Labels: autoconf, build, configure
>   Original Estimate: 10m
>  Remaining Estimate: 10m
>
> {code}
> marca@SCML-MarcA:~/src/trafficserver-3.0.2$ system_profiler -detailLevel mini 
> | grep 'System Version'
>   System Version: Mac OS X 10.6.8 (10K549)
> marca@SCML-MarcA:~/src/trafficserver-3.0.2$ ./configure CFLAGS=-w
> ...
> checking style of gethostbyname_r routine... glibc2
> checking 3rd argument to the gethostbyname_r routines... hostent_data
> configure: Build using CC=gcc
> configure: Build using CXX=g++
> configure: Build using CPP=gcc -E
> configure: Build using CFLAGS=-w -g -pipe -Wall -Werror -O3 
> -feliminate-unused-debug-symbols -fno-strict-aliasing
> ...
> marca@SCML-MarcA:~/src/trafficserver-3.0.2$ grep gethostbyname_r Makefile
> gethostbyname_r_glibc2 = 1
> gethostbyname_r_hostent_data = 1
> marca@SCML-MarcA:~/src/trafficserver-3.0.2$ make
> ...
> ink_inet.cc: In function 'hostent* ink_gethostbyaddr_r(char*, int, int, 
> ink_gethostbyaddr_r_data*)':
> ink_inet.cc:73: error: cannot convert 'hostent**' to 'int*' for argument '7' 
> to 'hostent* gethostbyaddr_r(const char*, size_t, int, hostent*, char*, int, 
> int*)'
> make[3]: *** [ink_inet.lo] Error 1
> make[2]: *** [all] Error 2
> make[1]: *** [all-recursive] Error 1
> make: *** [all-recursive] Error 1
> {code}
> Arguably, people should never run configure with CFLAGS=-w and this might 
> seem stupid and something that should never happen, but it turns out that 
> Homebrew (http://mxcl.github.com/homebrew/) does this by default 
> (https://github.com/mxcl/homebrew/issues/9728) -- I discovered this while 
> writing a Homebrew formula for Traffic Server 
> (https://github.com/mxcl/homebrew/pull/9513). After discovering that this was 
> causing problems, I modified my formula to tell Homebrew not to do this and 
> all is well, but I thought it would be interesting to make Traffic Server 
> resistant to this as well.
> I first tried to enable warnings by trying to find a gcc #pragma that could 
> go in the conftest.c code 
> (http://gcc.gnu.org/onlinedocs/gcc/Diagnostic-Pragmas.html looked promising 
> but I could not find one that worked), but I could no

[jira] [Issue Comment Edited] (TS-1091) `./configure CFLAGS=-w` causes configure script to wrongly guess style of `gethostbyname_r` on OS X (and probably other BSDs)

2012-01-23 Thread Marc Abramowitz (Issue Comment Edited) (JIRA)

[ 
https://issues.apache.org/jira/browse/TS-1091?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13191267#comment-13191267
 ] 

Marc Abramowitz edited comment on TS-1091 at 1/23/12 5:23 PM:
--

Hey Leif,

Yeah I really wanted to get it into a single regex, but it escaped me. The 
tricky part is handling -w at the beginning or end of CFLAGS. My instinct was 
to use "\b-w\b" but I don't think we can rely on sed (especially non-GNU sed) 
to support \b. Your regex looks like it will work though:

{code}
marca@SCML-MarcA:~/src/trafficserver-3.0.2$ echo "-Wall -Werror -w -O3" | sed 
's/ *-w */ /g'
-Wall -Werror -O3
marca@SCML-MarcA:~/src/trafficserver-3.0.2$ echo "-Wall -Werror -O3 -w" | sed 
's/ *-w */ /g'
-Wall -Werror -O3 
marca@SCML-MarcA:~/src/trafficserver-3.0.2$ echo "-w -Wall -Werror -O3" | sed 
's/ *-w */ /g'
 -Wall -Werror -O3
{code}

except here's one fake case that fails:

{code}
marca@SCML-MarcA:~/src/trafficserver-3.0.2$ echo "-Wall -fake-option-w -Werror 
-O3" | sed 's/ *-w */ /g'
-Wall -fake-option -Werror -O3
{code}

I don't know if there are any gcc options that actually end in "-w" though. :-)


  was (Author: msabramo):
Hey Leif,

Yeah I really wanted to get it into a single regex, but it escaped me. The 
tricky part is handling -w at the beginning or end of CFLAGS. My instinct was 
to use "\b-w\b" but I don't think we can rely on sed (especially non-GNU sed) 
to support \b. Your regex looks like it will work though:

{code}
marca@SCML-MarcA:~/src/trafficserver-3.0.2$ echo "-Wall -Werror -w -O3" | sed 
's/ *-w */ /g'
-Wall -Werror -O3
marca@SCML-MarcA:~/src/trafficserver-3.0.2$ echo "-Wall -Werror -O3 -w" | sed 
's/ *-w */ /g'
-Wall -Werror -O3 
marca@SCML-MarcA:~/src/trafficserver-3.0.2$ echo "-w -Wall -Werror -O3" | sed 
's/ *-w */ /g'
 -Wall -Werror -O3
{code}
  
> `./configure CFLAGS=-w` causes configure script to wrongly guess style of 
> `gethostbyname_r` on OS X (and probably other BSDs)
> -
>
> Key: TS-1091
> URL: https://issues.apache.org/jira/browse/TS-1091
> Project: Traffic Server
>  Issue Type: Bug
>  Components: Build
>Affects Versions: 3.0.2
> Environment: OS X 10.6.8
>Reporter: Marc Abramowitz
>Priority: Minor
>  Labels: autoconf, build, configure
>   Original Estimate: 10m
>  Remaining Estimate: 10m
>
> {code}
> marca@SCML-MarcA:~/src/trafficserver-3.0.2$ system_profiler -detailLevel mini 
> | grep 'System Version'
>   System Version: Mac OS X 10.6.8 (10K549)
> marca@SCML-MarcA:~/src/trafficserver-3.0.2$ ./configure CFLAGS=-w
> ...
> checking style of gethostbyname_r routine... glibc2
> checking 3rd argument to the gethostbyname_r routines... hostent_data
> configure: Build using CC=gcc
> configure: Build using CXX=g++
> configure: Build using CPP=gcc -E
> configure: Build using CFLAGS=-w -g -pipe -Wall -Werror -O3 
> -feliminate-unused-debug-symbols -fno-strict-aliasing
> ...
> marca@SCML-MarcA:~/src/trafficserver-3.0.2$ grep gethostbyname_r Makefile
> gethostbyname_r_glibc2 = 1
> gethostbyname_r_hostent_data = 1
> marca@SCML-MarcA:~/src/trafficserver-3.0.2$ make
> ...
> ink_inet.cc: In function 'hostent* ink_gethostbyaddr_r(char*, int, int, 
> ink_gethostbyaddr_r_data*)':
> ink_inet.cc:73: error: cannot convert 'hostent**' to 'int*' for argument '7' 
> to 'hostent* gethostbyaddr_r(const char*, size_t, int, hostent*, char*, int, 
> int*)'
> make[3]: *** [ink_inet.lo] Error 1
> make[2]: *** [all] Error 2
> make[1]: *** [all-recursive] Error 1
> make: *** [all-recursive] Error 1
> {code}
> Arguably, people should never run configure with CFLAGS=-w and this might 
> seem stupid and something that should never happen, but it turns out that 
> Homebrew (http://mxcl.github.com/homebrew/) does this by default 
> (https://github.com/mxcl/homebrew/issues/9728) -- I discovered this while 
> writing a Homebrew formula for Traffic Server 
> (https://github.com/mxcl/homebrew/pull/9513). After discovering that this was 
> causing problems, I modified my formula to tell Homebrew not to do this and 
> all is well, but I thought it would be interesting to make Traffic Server 
> resistant to this as well.
> I first tried to enable warnings by trying to find a gcc #pragma that could 
> go in the conftest.c code 
> (http://gcc.gnu.org/onlinedocs/gcc/Diagnostic-Pragmas.html looked promising 
> but I could not find one that worked), but I could not find any #pragma that 
> seemed to do this.
> I ended up making a small change to `build/common.m4` that strips -w out of 
> CFLAGS using `sed`.
> {code}
> --- build/common.m4.2012-01-22-092051 2011-05-25 13:19:54.0 -0700
> +++ build/common.m4   2012-01-22 22:48:14.00

[jira] [Issue Comment Edited] (TS-1091) `./configure CFLAGS=-w` causes configure script to wrongly guess style of `gethostbyname_r` on OS X (and probably other BSDs)

2012-01-23 Thread Leif Hedstrom (Issue Comment Edited) (JIRA)

[ 
https://issues.apache.org/jira/browse/TS-1091?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13191256#comment-13191256
 ] 

Leif Hedstrom edited comment on TS-1091 at 1/23/12 5:06 PM:


Would it not be possible to make a regex that captures all the "cases"? Perhaps 
something like (untested)

{code}
s/ *-w */ /g
{code}

? It means we might have an additional whitespace in the CFLAGs, but that seems 
ok :).

  was (Author: zwoop):
Would it not be possible to make a regex that captures all the "cases"? 
Perhaps something like (untested)

s/ *-w */ /g

? It means we might have an additional whitespace in the CFLAGs, but that seems 
ok :).
  
> `./configure CFLAGS=-w` causes configure script to wrongly guess style of 
> `gethostbyname_r` on OS X (and probably other BSDs)
> -
>
> Key: TS-1091
> URL: https://issues.apache.org/jira/browse/TS-1091
> Project: Traffic Server
>  Issue Type: Bug
>  Components: Build
>Affects Versions: 3.0.2
> Environment: OS X 10.6.8
>Reporter: Marc Abramowitz
>Priority: Minor
>  Labels: autoconf, build, configure
>   Original Estimate: 10m
>  Remaining Estimate: 10m
>
> {code}
> marca@SCML-MarcA:~/src/trafficserver-3.0.2$ system_profiler -detailLevel mini 
> | grep 'System Version'
>   System Version: Mac OS X 10.6.8 (10K549)
> marca@SCML-MarcA:~/src/trafficserver-3.0.2$ ./configure CFLAGS=-w
> ...
> checking style of gethostbyname_r routine... glibc2
> checking 3rd argument to the gethostbyname_r routines... hostent_data
> configure: Build using CC=gcc
> configure: Build using CXX=g++
> configure: Build using CPP=gcc -E
> configure: Build using CFLAGS=-w -g -pipe -Wall -Werror -O3 
> -feliminate-unused-debug-symbols -fno-strict-aliasing...
> {code}
> Arguably, people should never run configure with CFLAGS=-w and this might 
> seem stupid and something that should never happen, but it turns out that 
> Homebrew (http://mxcl.github.com/homebrew/) does this by default 
> (https://github.com/mxcl/homebrew/issues/9728) -- I discovered this while 
> writing a Homebrew formula for Traffic Server 
> (https://github.com/mxcl/homebrew/pull/9513). After discovering that this was 
> causing problems, I modified my formula to tell Homebrew not to do this and 
> all is well, but I thought it would be interesting to make Traffic Server 
> resistant to this as well.
> I first tried to enable warnings by trying to find a gcc #pragma that could 
> go in the conftest.c code, but I could not find any #pragma that seemed to do 
> this.
> I ended up making a small change to `build/common.m4` that strips -w out of 
> CFLAGS using `sed`.
> {code}
> --- build/common.m4.2012-01-22-092051 2011-05-25 13:19:54.0 -0700
> +++ build/common.m4   2012-01-22 22:48:14.0 -0800
> @@ -177,6 +177,7 @@
>   if test "$ac_cv_prog_gcc" = "yes"; then
> CFLAGS="$CFLAGS -Werror"
>   fi
> + CFLAGS=$(echo $CFLAGS | sed -e 's/^-w$//' -e 's/^-w //' -e 's/ -w$//' -e 
> 's/ -w / /')
>   AC_COMPILE_IFELSE([AC_LANG_SOURCE([
>[#include "confdefs.h"
>]
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira