On 01/15/2014 04:46 PM, Jonathan Schleifer wrote:
Am 14.01.2014 um 19:06 schrieb Ingo Weinhold <ingo_weinhold@xxxxxx>:I wouldn't do a per compiler file just for the -Werror settings, but I guess a file per compiler with various compiler specific setup, including the -Werror settings, wouldn't harm.Wouldn't this basically turn out to be what I did, specifying how -Werror should handled for the compiler in a central file? Btw: Even adding an (optional) argument to EnableWerror would be a bad idea: You would add a 1 there if it should be also enabled for Clang. What if we add other compilers, like Path64? Then we either need to convert it to a mask (not very user friendly) or add another argument (and thus change all places again).
>
Adding if ! $(CLANG) {} in the components where it should not be added would still be less work then changing all places, I guess. And would be more clear and would not need to be removed / changed when we add another compiler in the future.
The optional argument I suggested would be a build feature specification, i.e. a list of positive or negative build feature conditions (cf. [1]). E.g. "!gcc2 !clang" doesn't hold when the compiler is gcc2 or clang. So the first step would be to add "!clang" for each component. Essentially that's equivalent to enclosing the EnableWerror calls for the individual components in an "if ! $(CLANG) { ... }", just with a simpler syntax and one that scales better.
Anyway, I agree with Axel that it would be even cleaner to just have a separate file for each compiler. Not only because it saves the optional argument, but because it allows different component granularity. E.g. currently we enable -Werror for the whole "src/kits". With clang we might need to start smaller e.g. with "src/kits/support".
CU, Ingo [1] http://cgit.haiku-os.org/haiku/tree/build/jam/BuildFeatureRules#n25