diff mbox

=?UTF-8?Q?PR=20objc/24538=20(inconsistent=20objective-c=20objective-c++?= =?UTF-8?Q?=20language=20list)?=

Message ID 1290466904.04214888@192.168.2.227
State New
Headers show

Commit Message

Nicola Pero Nov. 22, 2010, 11:01 p.m. UTC
This is a patch for PR objc/24358.

The problem is that the list of languages for objective-c and objective-c++ 
is incorrect.  The GCC documentation mentions as valid languages

 objective-c
 objective-c-header
 objective-c-cpp-output

 objective-c++
 objective-c++-header
 objective-c++-cpp-output

which is nicely consistent with the list for c and c++ (eg, c++ has c++, c++-header, 
c++-cpp-output).

Unfortunately (PR objc/24358), the actual compiler is missing objective-c-cpp-output, 
and has objc-cpp-output instead.  It also supports the undocumented objc++-cpp-output 
in addition to objective-c++-cpp-output.

This patch changes the compiler to support the list of languages described in the GCC 
documentation.

Of course, there is the problem of what to do with objc-cpp-output and objc++-cpp-output.
In this patch I have left them as duplicates of objective-c-cpp-output and objective-c++-cpp-output 
for backwards-compatibility, but I hacked the lang spec for objc-cpp-output and objc++-cpp-output
to print a deprecation notice whenever they are used, inviting people to switch to objective-c-cpp-output 
and objective-c++-cpp-output.  We could leave objc-cpp-output and objc++-cpp-output there 
for a few years/releases, then remove them once people had time to update their software 
(assuming there is anyone using "-x objc-cpp-output").

Ok to commit ?

Thanks

PS: I tried clang and it supports the same list as in the GCC documentation, so we're also reducing
incompatibilities.

Comments

Mike Stump Nov. 22, 2010, 11:43 p.m. UTC | #1
On Nov 22, 2010, at 3:01 PM, Nicola Pero wrote:
> This is a patch for PR objc/24358.

> Ok to commit ?

Ok.
diff mbox

Patch

Index: objc/lang-specs.h
===================================================================
--- objc/lang-specs.h   (revision 167054)
+++ objc/lang-specs.h   (working copy)
@@ -19,8 +19,8 @@  along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
 
-/* This is the contribution to the `default_compilers' array in gcc.c for
-   objc.  */
+/* This is the contribution to the `default_compilers' array in gcc.c
+   for objc.  */
 
   {".m", "@objective-c", 0, 0, 0},
   {"@objective-c",
@@ -34,10 +34,6 @@  along with GCC; see the file COPYING3.  If not see
        %{!save-temps:%{!no-integrated-cpp:\
            cc1obj %(cpp_unique_options) %(cc1_options) %{print-objc-runtime-info} %{gen-decls}}}\
         %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
-  {".mi", "@objc-cpp-output", 0, 0, 0},
-  {"@objc-cpp-output",
-     "%{!M:%{!MM:%{!E:cc1obj -fpreprocessed %i %(cc1_options) %{print-objc-runtime-info} %{gen-decls}\
-                            %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
   {"@objective-c-header",
      "%{E|M|MM:cc1obj -E %{traditional|ftraditional|traditional-cpp:-traditional-cpp}\
           %(cpp_options) %(cpp_debug_options)}\
@@ -52,3 +48,11 @@  along with GCC; see the file COPYING3.  If not see
            cc1obj %(cpp_unique_options) %(cc1_options) %{print-objc-runtime-info} %{gen-decls}\
                         -o %g.s %{!o*:--output-pch=%i.gch}\
                         %W{o*:--output-pch=%*}%V}}}}}", 0, 0, 0},
+  {".mi", "@objective-c-cpp-output", 0, 0, 0},
+  {"@objective-c-cpp-output",
+     "%{!M:%{!MM:%{!E:cc1obj -fpreprocessed %i %(cc1_options) %{print-objc-runtime-info} %{gen-decls}\
+                            %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
+  {"@objc-cpp-output",
+      "%nobjc-cpp-output is deprecated; please use objective-c-cpp-output instead\n\
+       %{!M:%{!MM:%{!E:cc1obj -fpreprocessed %i %(cc1_options) %{print-objc-runtime-info} %{gen-decls}\
+                            %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
Index: objc/ChangeLog
===================================================================
--- objc/ChangeLog      (revision 167054)
+++ objc/ChangeLog      (working copy)
@@ -1,5 +1,12 @@ 
 2010-11-22  Nicola Pero  <nicola.pero@meta-innovation.com>
 
+       PR objc/24358
+       * lang-specs.h: Added objective-c-cpp-output.  Mapped .mi to
+       objective-c-cpp-output instead of objc-cpp-output.  Print a
+       deprecation note every time objc-cpp-output is requested.
+
+2010-11-22  Nicola Pero  <nicola.pero@meta-innovation.com>
+
        PR objc/41108
        * objc-act.c (objc_generate_write_barrier): Added assert to make sure
        this function is only called with the next runtime.
Index: objcp/lang-specs.h
===================================================================
--- objcp/lang-specs.h  (revision 167054)
+++ objcp/lang-specs.h  (working copy)
@@ -55,6 +55,7 @@  along with GCC; see the file COPYING3.  If not see
     cc1objplus -fpreprocessed %i %(cc1_options) %2\
     %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
   {"@objc++-cpp-output",
-   "%{!M:%{!MM:%{!E:\
+   "%nobjc++-cpp-output is deprecated; please use objective-c++-cpp-output instead\n\
+    %{!M:%{!MM:%{!E:\
     cc1objplus -fpreprocessed %i %(cc1_options) %2\
     %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
Index: objcp/ChangeLog
===================================================================
--- objcp/ChangeLog     (revision 167054)
+++ objcp/ChangeLog     (working copy)
@@ -1,3 +1,9 @@ 
+2010-11-22  Nicola Pero  <nicola.pero@meta-innovation.com>
+
+       PR objc/24358
+       * lang-specs.h: Print a deprecation note every time
+       objc++-cpp-output is requested.
+
 2010-10-24  Nicola Pero  <nicola.pero@meta-innovation.com>
 
        * objcp-lang.c (LANG_HOOKS_DECL_PRINTABLE_NAME): Do not define.