On 12 October 2012 17:18, Joseph S. Myers <jos...@codesourcery.com> wrote: > On Fri, 12 Oct 2012, Manuel López-Ibáñez wrote: > >> I am trying to encode the relationship between Wstrict-aliasing and >> Wstrict-aliasing= in the .opt files, and the same for Wstrict-overflow >> and Wstrict-overflow=. However, the parameters of Alias() are taken as >> strings, so we get "3" and "WARN_STRICT_OVERFLOW_CONDITIONAL". Do you >> have a suggestion how to handle this? > > I don't see what the problem is supposed to be. Yes, the arguments are > strings - they describe how one option that the user might pass on the > command line is exactly equivalent to another that they might pass (up to > and including the latter form of the option being the one that is used > when matching specs and multilibs, because the driver does the > translation, including working out the canonical textual form of the > option, before processing specs against the command line). > > If -Wstrict-overflow on the command line is equivalent to > -Wstrict-overflow=WARN_STRICT_OVERFLOW_CONDITIONAL on the command line, > then specify WARN_STRICT_OVERFLOW_CONDITIONAL in the parameters. If it's > equivalent to something else, specify something else. > >> My next step would be to handle aliases also when internally >> generating options, so I can add EnabledBy(Wall) to Wstrict-aliasing. >> Does this sound ok to you? > > That seems reasonable.
OK. The attached patch implements this. Does the approach look ok? I will write changelog and more comments if it seems reasonable. One thing I don't like is that now we print [-Werror=strict-aliasing=] in diagnostics. Two questions: 1) Are references allowed now that C++ is the default? 2) While fixing this, I was thinking: Why the difference between Joined and Separate? Why not make every function that takes an argument work with and without '=' and with separate argument. It seems we could remove a lot of options this way. What I am proposing is, instead of: aux-info Common Separate Var(aux_info_file_name) -aux-info <file> Emit declaration information into <file> aux-info= Common Joined Alias(aux-info) simply aux-info Common RequiredArgument Var(aux_info_file_name) -aux-info <file> Emit declaration information into <file> and all of these would be accepted: aux-infoFILE /* we could accept this to be compatible with some options like -B */ aux-info=FILE aux-info FILE We have dozens of options like these. Moreover, we could replace: Wstrict-aliasing Common Alias(Wstrict-aliasing=, 3, 0) Warning Warn about code which might break strict aliasing rules Wstrict-aliasing= Common Joined RejectNegative UInteger Var(warn_strict_aliasing) Warning Warn about code which might break strict aliasing rules with: Wstrict-aliasing Common MissingArgument(3) UInteger Var(warn_strict_aliasing) Warning Warn about code which might break strict aliasing rules and all of these will be accepted: Wstrict-aliasing Wno-strict-aliasing Wstrict-aliasing2 Wstrict-aliasing=2 Wstrict-aliasing 2 Werror=strict-aliasing Wno-error=strict-aliasing Cheers, Manuel.
lang-enabled-by-with-args.diff
Description: Binary data