This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: ObjC/ObjC++: updated documentation on supported standards, and added -fobjc-std=objc1

On 2 Nov 2010, at 18:58, Nicola Pero wrote:

If we don't want to use "std", maybe I'd be happy with -fobjc-

Mike OK'd it already ;-)

Yes, but that doesn't mean we can't discuss it further :-)

indeed .. :-)
.. and rest assured if I feel strongly about something .. I will argue ;)
but I'm happy to go with the consensus.

I think Mike approved it because the patch is good enough to go in (which
it is); if we come up with something better, or if someone has good objections,
we can always submit a revised patch, or a followup patch.

I was nit-picking really (re. no actual standards) ... ... in which respect it would differ from the -std= option.

Having discussed it for a bit, I actually now quite like the original choice of -fobjc-std=objc1.
The reasons are:

I agree, -fobjc-std= or -objc-std= is clearer than -fobjc-dialect (which would be confusing, I suspect).

* it is similar to -fobjc-exceptions, which enables/disables @synchronized, @try/@catch/@finally.
So you'll find it in the same place in the GCC manual, and consistently starts with "-fobjc-" like
the new option and the other ObjC language options;

* it is similar to -std=xxx, but orthogonal to it, so you can for example use
"-std=c99 -fobjc-std=objc1" or "-std=gnu89 -fobjc-std=objc1" and get a different language (people
who use these flags can get very hot about these things; if we have orthogonal flags for C/C++ and
ObjC, we can make them happy no matter what combination they ask for);

* it takes a short keyword as argument, so it should be robust if we need to add other language
dialects in the future;

* inside the GCC source code, I used "if (flag_objc1_only)" to detect the case that Objective-C 1.0
was requested (which should be fairly self-explanatory, much more self-explanatory that "if (flag_gcc40)"),
and I like the option having the same name (objc1) in the command- line option so it's easy to make
the association between "if (flag_objc1_only)" and "-fobjc-std=objc1"

yes - choosing the tags for ready cross-reference & understanding is important.

I guess the only other main contendents would be -fobjc1-only (which I actually like to as it is clear
and immediately maps to "if (objc1_only)" in the code), but then if/ when the language changes again
we'd have to add another flag, and it's neater to have just one (- fobjc-std=...) with an enumeration
of the values.

I agree 100% about the desirability of an enum - once can then switch on lang variant etc.
we def. don't want to proliferate flags.
Hm - how does -std= do it ?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]