This is the mail archive of the gcc-patches@gcc.gnu.org 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]

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


This patch:

 * updates the documentation on the version of Objective-C/Objective-C++ 
supported by the compiler;

 * adds a new -fobjc-std=objc1 option which causes the compiler to accept only 
the Objective-C 1.0 syntax (which for clarity of definition I defined as the 
Objective-C syntax accepted by GCC 4.0);

 * adds testcases for the new option.

The reason that this new option is useful is that some projects have
a large Objective-C codebase and require the codebase to compile with different
versions of GCC, including old ones.  It is handy to be able to have a flag
that will prevent people with new compilers from committing code that uses
a syntax not supported by old compilers.

Of course, the default is to allow all the Objective-C 2.0 extensions.  This flag is
only for people who have a specific reason to disable the extensions. :-)

The option name itself is not set in stone; suggestions I welcome.  I like 
-fobjc-std=xxx (as opposed to, say, -fobjc-language-version=1 / -fobjc-language-version=2) 
for consistency with -std=xxx and because we don't know how future versions of the language 
may be named or presented so having a free string there helps to be adaptable (in the same 
way as it works for -std=xxx in C/C++).

About the short string used to mean 'Objective-C 1.0', I chose 'objc1'.  An alternative
would be choosing 'gcc40', so the option could become -fobjc-std=gcc40.  That may be 
more accurate, but less obvious (or maybe not).

I'm happy to take suggestions on that.

Else, Ok to commit to trunk ?

Thanks

In gcc/:
2010-11-02  Nicola Pero  <nicola.pero@meta-innovation.com>

        Implemented -fobjc-std=objc1 flag.
        * doc/invoke.texi (Option Summary): Document -fobjc-std=objc1
        option.
        * doc/standards.texi (Standards): Updated the section on
        Objective-C; mention support for Objective-C 2.0 features and the
        new -fstd-objc=objc1 flag to disable them.

In gcc/c-family/:
2010-11-02  Nicola Pero  <nicola.pero@meta-innovation.com>

        Implemented -fobjc-std=objc1 flag.
        * c.opt (fobjc-std=objc1): New option.

In gcc/objc/:
2010-11-02  Nicola Pero  <nicola.pero@meta-innovation.com>

        Implemented -fobjc-std=objc1 flag.
        * objc-act.c (objc_start_class_interface): If attributes are
        specified when flag_objc1_only is set, print an error.
        (objc_start_category_interface): Same change.
        (objc_start_protocol): Same change.
        (objc_add_method_declaration): Same change.
        (objc_start_method_definition): Same change.
        (objc_build_keyword_decl): Same change.
        (objc_set_method_opt): If flag_objc1_only is set, print an error.
        (objc_add_property_declaration): Same change.
        (objc_add_synthesize_declaration): Same change.
        (objc_add_dynamic_declaration): Same change.
        (objc_finish_foreach_loop): Same change.
        (objc_maybe_build_component_ref): If flag_objc1_only is set,
        return immediately.

In gcc/testsuite/:
2010-11-02  Nicola Pero  <nicola.pero@meta-innovation.com>

        Implemented -fobjc-std=objc1 flag.
        * objc.dg/fobjc-std-1.mm: New.
        * obj-c++.dg/fobjc-std-1.mm: New.

Attachment: patch.txt
Description: Text document


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