* [patch] PR target/54160: Only set __OBJC2__ when compiling OBJC.
@ 2012-12-04 22:25 Aldy Hernandez
2012-12-05 14:56 ` Aldy Hernandez
0 siblings, 1 reply; 4+ messages in thread
From: Aldy Hernandez @ 2012-12-04 22:25 UTC (permalink / raw)
To: gcc-patches
[-- Attachment #1: Type: text/plain, Size: 535 bytes --]
The problem here is that we are setting __OBJC2__ regardless of what
language we are compiling.
Tested by building a cross cc1/cc1obj for x86_64-unknown-darwin, and
doing the following:
reynosa:/build/trunk-darwin-objc/gcc$ echo "" | ./cc1obj -E -dM -
-quiet |grep OBJ
#define __OBJC__ 1
#define __OBJC2__ 1
reynosa:/build/trunk-darwin-objc/gcc$ echo "" | ./cc1 -E -dM - -quiet
|grep OBJ
It would be nice if someone with access to a Darwin build system could
test this further, but this at least fixes the PR.
OK for trunk?
[-- Attachment #2: curr --]
[-- Type: text/plain, Size: 1408 bytes --]
PR target/54160
* config/t-darwin: Depend on CPP_INTERNAL_H.
* config/darwin-c.c (darwin_cpp_builtins): Only set __OBJC2__ when
in obj mode.
Include libcpp/internal.h.
diff --git a/gcc/config/darwin-c.c b/gcc/config/darwin-c.c
index 8e48c30..ec8aa9c 100644
--- a/gcc/config/darwin-c.c
+++ b/gcc/config/darwin-c.c
@@ -38,6 +38,7 @@ along with GCC; see the file COPYING3. If not see
#include "c-family/c-target.h"
#include "c-family/c-target-def.h"
#include "cgraph.h"
+#include "../../libcpp/internal.h"
/* Pragmas. */
@@ -632,7 +633,7 @@ darwin_cpp_builtins (cpp_reader *pfile)
builtin_define ("__weak=");
}
- if (flag_objc_abi == 2)
+ if (CPP_OPTION (pfile, objc) && flag_objc_abi == 2)
builtin_define ("__OBJC2__");
}
diff --git a/gcc/config/t-darwin b/gcc/config/t-darwin
index e2bd74d..0e8346b 100644
--- a/gcc/config/t-darwin
+++ b/gcc/config/t-darwin
@@ -29,7 +29,7 @@ darwin.o: $(srcdir)/config/darwin.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
darwin-c.o: $(srcdir)/config/darwin-c.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
$(TM_H) $(CPPLIB_H) $(TREE_H) $(C_PRAGMA_H) $(TM_P_H) \
- incpath.h flags.h $(C_COMMON_H) $(C_TARGET_H) $(C_TARGET_DEF_H)
+ incpath.h flags.h $(C_COMMON_H) $(C_TARGET_H) $(C_TARGET_DEF_H) $(CPP_INTERNAL_H)
$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
$(srcdir)/config/darwin-c.c $(PREPROCESSOR_DEFINES)
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [patch] PR target/54160: Only set __OBJC2__ when compiling OBJC.
2012-12-04 22:25 [patch] PR target/54160: Only set __OBJC2__ when compiling OBJC Aldy Hernandez
@ 2012-12-05 14:56 ` Aldy Hernandez
2012-12-05 18:22 ` Aldy Hernandez
0 siblings, 1 reply; 4+ messages in thread
From: Aldy Hernandez @ 2012-12-05 14:56 UTC (permalink / raw)
To: gcc-patches; +Cc: mikestump, echristo, stanshebs, iains
Hi gentlemen.
Just in case you missed this post. This only affects Darwin, so it's
technically not just an Objective C problem. This problem came about
with Ian Sandoe's patch of rev@170260. The CPP builtin "__OBJC2__" is
only set for Darwin.
FYI, in this patch I followed the way we currently set __OBJC__ in
libcpp/init.c:
if (CPP_OPTION (pfile, objc))
_cpp_define_builtin (pfile, "__OBJC__ 1");
I hope this helps in reviewing the patch.
Thanks.
On 12/04/12 16:25, Aldy Hernandez wrote:
> The problem here is that we are setting __OBJC2__ regardless of what
> language we are compiling.
>
> Tested by building a cross cc1/cc1obj for x86_64-unknown-darwin, and
> doing the following:
>
> reynosa:/build/trunk-darwin-objc/gcc$ echo "" | ./cc1obj -E -dM -
> -quiet |grep OBJ
> #define __OBJC__ 1
> #define __OBJC2__ 1
> reynosa:/build/trunk-darwin-objc/gcc$ echo "" | ./cc1 -E -dM - -quiet
> |grep OBJ
>
> It would be nice if someone with access to a Darwin build system could
> test this further, but this at least fixes the PR.
>
> OK for trunk?
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [patch] PR target/54160: Only set __OBJC2__ when compiling OBJC.
2012-12-05 14:56 ` Aldy Hernandez
@ 2012-12-05 18:22 ` Aldy Hernandez
2012-12-05 20:58 ` Mike Stump
0 siblings, 1 reply; 4+ messages in thread
From: Aldy Hernandez @ 2012-12-05 18:22 UTC (permalink / raw)
To: gcc-patches; +Cc: mikestump, echristo, stanshebs, iains, Jakub Jelinek
[-- Attachment #1: Type: text/plain, Size: 60 bytes --]
Adjusted ChangeLog entry as suggested by Jakub on IRC.
OK?
[-- Attachment #2: curr --]
[-- Type: text/plain, Size: 1582 bytes --]
commit ddc4494409331e5a75814a6c8a57aa0646257fb2
Author: Aldy Hernandez <aldyh@redhat.com>
Date: Wed Dec 5 08:38:10 2012 -0600
PR target/54160
* config/t-darwin (darwin-c.o): Depend on $(CPP_INTERNAL_H).
* config/darwin-c.c (darwin_cpp_builtins): Only set __OBJC2__
* when
in obj mode.
Include libcpp/internal.h.
diff --git a/gcc/config/darwin-c.c b/gcc/config/darwin-c.c
index 8e48c30..ec8aa9c 100644
--- a/gcc/config/darwin-c.c
+++ b/gcc/config/darwin-c.c
@@ -38,6 +38,7 @@ along with GCC; see the file COPYING3. If not see
#include "c-family/c-target.h"
#include "c-family/c-target-def.h"
#include "cgraph.h"
+#include "../../libcpp/internal.h"
/* Pragmas. */
@@ -632,7 +633,7 @@ darwin_cpp_builtins (cpp_reader *pfile)
builtin_define ("__weak=");
}
- if (flag_objc_abi == 2)
+ if (CPP_OPTION (pfile, objc) && flag_objc_abi == 2)
builtin_define ("__OBJC2__");
}
diff --git a/gcc/config/t-darwin b/gcc/config/t-darwin
index e2bd74d..0e8346b 100644
--- a/gcc/config/t-darwin
+++ b/gcc/config/t-darwin
@@ -29,7 +29,7 @@ darwin.o: $(srcdir)/config/darwin.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
darwin-c.o: $(srcdir)/config/darwin-c.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
$(TM_H) $(CPPLIB_H) $(TREE_H) $(C_PRAGMA_H) $(TM_P_H) \
- incpath.h flags.h $(C_COMMON_H) $(C_TARGET_H) $(C_TARGET_DEF_H)
+ incpath.h flags.h $(C_COMMON_H) $(C_TARGET_H) $(C_TARGET_DEF_H) $(CPP_INTERNAL_H)
$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
$(srcdir)/config/darwin-c.c $(PREPROCESSOR_DEFINES)
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [patch] PR target/54160: Only set __OBJC2__ when compiling OBJC.
2012-12-05 18:22 ` Aldy Hernandez
@ 2012-12-05 20:58 ` Mike Stump
0 siblings, 0 replies; 4+ messages in thread
From: Mike Stump @ 2012-12-05 20:58 UTC (permalink / raw)
To: Aldy Hernandez; +Cc: gcc-patches, echristo, stanshebs, iains, Jakub Jelinek
On Dec 5, 2012, at 10:22 AM, Aldy Hernandez <aldyh@redhat.com> wrote:
> Adjusted ChangeLog entry as suggested by Jakub on IRC.
>
> OK?
Ok. Please watch for hate mail from cpp folks that don't want internal being used in this way…
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-12-05 20:58 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-04 22:25 [patch] PR target/54160: Only set __OBJC2__ when compiling OBJC Aldy Hernandez
2012-12-05 14:56 ` Aldy Hernandez
2012-12-05 18:22 ` Aldy Hernandez
2012-12-05 20:58 ` Mike Stump
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).