Re: [gentoo-dev] automatically killing invalid CFLAGS/warning about bad CFLAGS

2006-04-14 Thread Harald van D??k
On Thu, Apr 13, 2006 at 10:49:24PM -0400, Patrick McLean wrote:
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1
 
 Alec Warner wrote:
  
  Except you need a way for them to turn it off, and you do not currently
  provide one.  We can set default flags all we want, but I don't see
  filtering 'bad' flags as necessarily our problem.  If you want to say:
  
  Hey we have had issues with people filing bogus bug reports with CFLAGS
  that are completely inappropriate, so by default we check the sanity of
  your CFLAGS, this is how you turn those checks off. then I'd be ok with it.
 
  Most of the Ricers won't read it, and maybe you can print a warning that
  CFLAG checking is disabled.
  
  However leaving it on all the time merely imposes penalties on the power
  users who wish to use your profile.  Your profile is a tool that should
  be useful to all classes of users.
  
 
 The only flags that are actually removed are the _invalid_ flags. These are 
 the
 flags that gcc does not accept, and will error out on. The bad flags, IE the
 ones that the developers consider to be broken, but that are accepted by gcc 
 are
 not filtered, the profile simply prints a warning and pauses for 5 seconds to
 encourage users to read the warning, it does not automatically filter any 
 flags
 that the compiler accepts.

The only flags that are actually removed are the flags that are invalid
_by themselves_. There are cases where flags are valid because of other
flags, such as anything following -X*.

Two other problems I see with the code:
CFLAGS=${CFLAGS//bad-flag} is in the ebuild quiz, if I recall correctly.
It's broken because it also removes valid flags that happen to contain
bad-flag as a substring.
Locale isn't forced to C, which means gcc may not spit out 'unrecognized
option' at all even for invalid flags.
-- 
gentoo-dev@gentoo.org mailing list



Re: [gentoo-dev] automatically killing invalid CFLAGS/warning about bad CFLAGS

2006-04-14 Thread Patrick McLean
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Harald van D?k wrote:
 The only flags that are actually removed are the flags that are invalid
 _by themselves_. There are cases where flags are valid because of other
 flags, such as anything following -X*.

 Two other problems I see with the code:
 CFLAGS=${CFLAGS//bad-flag} is in the ebuild quiz, if I recall correctly.
 It's broken because it also removes valid flags that happen to contain
 bad-flag as a substring.
 Locale isn't forced to C, which means gcc may not spit out 'unrecognized
 option' at all even for invalid flags.

There is a new version at http://dev.gentoo.org/~chutzpah/profile.bashrc that
should fix all these possible problems. Thanks for pointing them out, let me
know if you see anything else.
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.2.2 (GNU/Linux)

iD8DBQFEP+A9Wt/XSf2CZdkRArP3AKCZZQd7V7oBTsQnxzBMDXX9VGnxpQCbBm4l
vr359Gk/O0NPPk2/2CnUPw8=
=3HQj
-END PGP SIGNATURE-
-- 
gentoo-dev@gentoo.org mailing list



Re: [gentoo-dev] automatically killing invalid CFLAGS/warning about bad CFLAGS

2006-04-14 Thread Joshua Nichols
Patrick McLean wrote:
 Harald van D?k wrote:
  The only flags that are actually removed are the flags that are invalid
  _by themselves_. There are cases where flags are valid because of other
  flags, such as anything following -X*.
 
  Two other problems I see with the code:
  CFLAGS=${CFLAGS//bad-flag} is in the ebuild quiz, if I recall
 correctly.
  It's broken because it also removes valid flags that happen to contain
  bad-flag as a substring.
  Locale isn't forced to C, which means gcc may not spit out
 'unrecognized
  option' at all even for invalid flags.

 There is a new version at
 http://dev.gentoo.org/~chutzpah/profile.bashrc that
 should fix all these possible problems. Thanks for pointing them out,
 let me
 know if you see anything else.
Around line 77, you have:
hasme ${flag} ${CFLAGS} ${CXXFLAGS}  trigger=1  \
ewarn Your C(XX)FLAGS contain(s) \${flag}\ which can break
packages.

Might I suggest you change it to something like:

if hasme ${flag} ${CFLAGS} ${CXXFLAGS}; then
   trigger=1
   ewarn Your C(XX)FLAGS contain(s) \${flag}\ which can break
packages.
fi

While there's nothing wrong with the original way, my suggestion would
make it a bit more obvious that you're setting the 'trigger' flag.

Regards,

Josh
-- 
gentoo-dev@gentoo.org mailing list



Re: [gentoo-dev] automatically killing invalid CFLAGS/warning about bad CFLAGS

2006-04-14 Thread Patrick McLean
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Joshua Nichols wrote:
 Patrick McLean wrote:
 There is a new version at
 http://dev.gentoo.org/~chutzpah/profile.bashrc that
 should fix all these possible problems. Thanks for pointing them out,
 Around line 77, you have:
 hasme ${flag} ${CFLAGS} ${CXXFLAGS}  trigger=1  \
 ewarn Your C(XX)FLAGS contain(s) \${flag}\ which can break
 packages.
 
 Might I suggest you change it to something like:
 
 if hasme ${flag} ${CFLAGS} ${CXXFLAGS}; then
trigger=1
ewarn Your C(XX)FLAGS contain(s) \${flag}\ which can break
 packages.
 fi
 
Done.

 While there's nothing wrong with the original way, my suggestion would
 make it a bit more obvious that you're setting the 'trigger' flag.
 
Readability is always a good thing :)
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.2.2 (GNU/Linux)

iD8DBQFEP+cJWt/XSf2CZdkRAoGtAJ9e8CViKyluILpEH07J3i50ciuNnwCZAVu/
M94FKLlae7tyTRZ8TsE40zA=
=XkHW
-END PGP SIGNATURE-
-- 
gentoo-dev@gentoo.org mailing list



Re: [gentoo-dev] automatically killing invalid CFLAGS/warning about bad CFLAGS

2006-04-14 Thread Harald van D??k
On Fri, Apr 14, 2006 at 01:47:41PM -0400, Patrick McLean wrote:
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1
 
 Harald van D?k wrote:
  The only flags that are actually removed are the flags that are invalid
  _by themselves_. There are cases where flags are valid because of other
  flags, such as anything following -X*.
 
  Two other problems I see with the code:
  CFLAGS=${CFLAGS//bad-flag} is in the ebuild quiz, if I recall correctly.
  It's broken because it also removes valid flags that happen to contain
  bad-flag as a substring.
  Locale isn't forced to C, which means gcc may not spit out 'unrecognized
  option' at all even for invalid flags.
 
 There is a new version at http://dev.gentoo.org/~chutzpah/profile.bashrc that
 should fix all these possible problems. Thanks for pointing them out, let me
 know if you see anything else.

For the locale stuff, you're not exporting LC_ALL, which means if LC_ALL
is unset, and LC_MESSAGES is set, gcc might still spit out French (for
example) error messages. Also, it can be made simpler: changing the
command to `LC_ALL=C ${myprog} [EMAIL PROTECTED] -E - 21` should do it. LC_ALL
overrides LANG, so that can be left alone, and adding it right in front
of the command makes sure it gets exported, but not in the current
shell, so there's no need to manually restore it.
-- 
gentoo-dev@gentoo.org mailing list



Re: [gentoo-dev] automatically killing invalid CFLAGS/warning about bad CFLAGS

2006-04-14 Thread Mike Frysinger
On Friday 14 April 2006 13:47, Patrick McLean wrote:
 There is a new version at http://dev.gentoo.org/~chutzpah/profile.bashrc
 that should fix all these possible problems. Thanks for pointing them out,
 let me know if you see anything else.

that hasme() func can be replaced with 1 line of code ... look at how i 
rewrote has() in latest portage 2.1-pre
-mike
-- 
gentoo-dev@gentoo.org mailing list



[gentoo-dev] automatically killing invalid CFLAGS/warning about bad CFLAGS

2006-04-13 Thread Patrick McLean
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

For about a month now, we (amd64) have had some code in our
profile.bashrc that filters CFLAGS that are unrecognized by gcc, and
warnings the user about bad CFLAGS.

So far it has worked fairly well, and it has really cut down on the
number of bugs that filed by people with extreme ricer CFLAGS. It might
be an idea to have something similar in the global bashrc, and have a
system for arches to customize the CFLAGS that are warned about.

The code is at gentoo-x86/profiles/default-linux/amd64/profile.bashrc
for those who want to see it.
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFEPqtzWt/XSf2CZdkRArCCAKCR66ousc1+FGOMvz9hGxqFsA0jWQCfbyEM
YexV1DYsR286gW+XGyG9Ah4=
=ha1J
-END PGP SIGNATURE-
-- 
gentoo-dev@gentoo.org mailing list



Re: [gentoo-dev] automatically killing invalid CFLAGS/warning about bad CFLAGS

2006-04-13 Thread Alec Warner
Patrick McLean wrote:
 For about a month now, we (amd64) have had some code in our
 profile.bashrc that filters CFLAGS that are unrecognized by gcc, and
 warnings the user about bad CFLAGS.
 
 So far it has worked fairly well, and it has really cut down on the
 number of bugs that filed by people with extreme ricer CFLAGS. It might
 be an idea to have something similar in the global bashrc, and have a
 system for arches to customize the CFLAGS that are warned about.
 
 The code is at gentoo-x86/profiles/default-linux/amd64/profile.bashrc
 for those who want to see it.

Except you need a way for them to turn it off, and you do not currently
provide one.  We can set default flags all we want, but I don't see
filtering 'bad' flags as necessarily our problem.  If you want to say:

Hey we have had issues with people filing bogus bug reports with CFLAGS
that are completely inappropriate, so by default we check the sanity of
your CFLAGS, this is how you turn those checks off. then I'd be ok with it.

Most of the Ricers won't read it, and maybe you can print a warning that
CFLAG checking is disabled.

However leaving it on all the time merely imposes penalties on the power
users who wish to use your profile.  Your profile is a tool that should
be useful to all classes of users.

-Alec Warner
-- 
gentoo-dev@gentoo.org mailing list



Re: [gentoo-dev] automatically killing invalid CFLAGS/warning about bad CFLAGS

2006-04-13 Thread Patrick McLean
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Alec Warner wrote:
 
 Except you need a way for them to turn it off, and you do not currently
 provide one.  We can set default flags all we want, but I don't see
 filtering 'bad' flags as necessarily our problem.  If you want to say:
 
 Hey we have had issues with people filing bogus bug reports with CFLAGS
 that are completely inappropriate, so by default we check the sanity of
 your CFLAGS, this is how you turn those checks off. then I'd be ok with it.

 Most of the Ricers won't read it, and maybe you can print a warning that
 CFLAG checking is disabled.
 
 However leaving it on all the time merely imposes penalties on the power
 users who wish to use your profile.  Your profile is a tool that should
 be useful to all classes of users.
 

The only flags that are actually removed are the _invalid_ flags. These are the
flags that gcc does not accept, and will error out on. The bad flags, IE the
ones that the developers consider to be broken, but that are accepted by gcc are
not filtered, the profile simply prints a warning and pauses for 5 seconds to
encourage users to read the warning, it does not automatically filter any flags
that the compiler accepts.
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.2.2 (GNU/Linux)

iD8DBQFEPw20Wt/XSf2CZdkRAotCAJ9pRFXAbPine5qYbycGXoeDWyy+DACaA84z
KZ43edqxiv30vniE2e2wxlc=
=0vEQ
-END PGP SIGNATURE-
-- 
gentoo-dev@gentoo.org mailing list