public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Disable ppc/spu context sensitive macros for CLK_ASM preprocessing (PR preprocessor/61977)
@ 2015-04-01  8:40 Jakub Jelinek
  2015-04-01  8:57 ` Steven Bosscher
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Jakub Jelinek @ 2015-04-01  8:40 UTC (permalink / raw)
  To: David Edelsohn, Ulrich Weigand; +Cc: gcc-patches

Hi!

The context sensitive macros are inherently C/C++ specific, so trying to
expand them into anything when preprocessing assembler doesn't make any
sense to me.

Ok for trunk?

2015-04-01  Jakub Jelinek  <jakub@redhat.com>

	PR preprocessor/61977
	* config/rs6000/rs6000-c.c (rs6000_cpu_cpp_builtins): Don't
	predefine __vector/__bool/__pixel macros nor context sensitive
	macros for CLK_ASM.
	* config/spu/spu-c.c (spu_cpu_cpp_builtins): Similarly.

--- gcc/config/rs6000/rs6000-c.c.jj	2015-01-09 22:00:06.000000000 +0100
+++ gcc/config/rs6000/rs6000-c.c	2015-04-01 10:31:19.127603956 +0200
@@ -420,7 +420,7 @@ rs6000_cpu_cpp_builtins (cpp_reader *pfi
   if (TARGET_FRSQRTES)
     builtin_define ("__RSQRTEF__");
 
-  if (TARGET_EXTRA_BUILTINS)
+  if (TARGET_EXTRA_BUILTINS && cpp_get_options (pfile)->lang != CLK_ASM)
     {
       /* Define the AltiVec syntactic elements.  */
       builtin_define ("__vector=__attribute__((altivec(vector__)))");
--- gcc/config/spu/spu-c.c.jj	2015-01-09 22:00:01.000000000 +0100
+++ gcc/config/spu/spu-c.c	2015-04-01 10:33:20.473610886 +0200
@@ -203,7 +203,8 @@ spu_cpu_cpp_builtins (struct cpp_reader
   cpp_assert (pfile, "machine=spu");
   if (spu_arch == PROCESSOR_CELLEDP)
     cpp_define (pfile, "__SPU_EDP__");
-  cpp_define (pfile, "__vector=__attribute__((__spu_vector__))");
+  if (cpp_get_options (pfile)->lang != CLK_ASM)
+    cpp_define (pfile, "__vector=__attribute__((__spu_vector__))");
   switch (spu_ea_model)
     {
     case 32:
@@ -216,7 +217,7 @@ spu_cpu_cpp_builtins (struct cpp_reader
        gcc_unreachable ();
     }
 
-  if (!flag_iso)
+  if (!flag_iso && cpp_get_options (pfile)->lang != CLK_ASM)
     {
       /* Define this when supporting context-sensitive keywords.  */
       cpp_define (pfile, "__VECTOR_KEYWORD_SUPPORTED__");

	Jakub

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Disable ppc/spu context sensitive macros for CLK_ASM preprocessing (PR preprocessor/61977)
  2015-04-01  8:40 [PATCH] Disable ppc/spu context sensitive macros for CLK_ASM preprocessing (PR preprocessor/61977) Jakub Jelinek
@ 2015-04-01  8:57 ` Steven Bosscher
  2015-04-01  9:13   ` Jakub Jelinek
  2015-04-01 12:09 ` Ulrich Weigand
  2015-04-02  3:05 ` David Edelsohn
  2 siblings, 1 reply; 5+ messages in thread
From: Steven Bosscher @ 2015-04-01  8:57 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: David Edelsohn, Ulrich Weigand, GCC Patches

On Wed, Apr 1, 2015 at 10:40 AM, Jakub Jelinek wrote:
> Hi!
>
> The context sensitive macros are inherently C/C++ specific, so trying to
> expand them into anything when preprocessing assembler doesn't make any
> sense to me.

Why are the <arch>-c.c cpp builtins defined at all when preprocessing
assembly? Or in other words: should these (supposedly)
language-dependent hooks for cpp builtins be called if the
pre-processor is called stand-alone?

Ciao!
Steven

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Disable ppc/spu context sensitive macros for CLK_ASM preprocessing (PR preprocessor/61977)
  2015-04-01  8:57 ` Steven Bosscher
@ 2015-04-01  9:13   ` Jakub Jelinek
  0 siblings, 0 replies; 5+ messages in thread
From: Jakub Jelinek @ 2015-04-01  9:13 UTC (permalink / raw)
  To: Steven Bosscher; +Cc: David Edelsohn, Ulrich Weigand, GCC Patches

On Wed, Apr 01, 2015 at 10:57:10AM +0200, Steven Bosscher wrote:
> On Wed, Apr 1, 2015 at 10:40 AM, Jakub Jelinek wrote:
> > Hi!
> >
> > The context sensitive macros are inherently C/C++ specific, so trying to
> > expand them into anything when preprocessing assembler doesn't make any
> > sense to me.
> 
> Why are the <arch>-c.c cpp builtins defined at all when preprocessing
> assembly? Or in other words: should these (supposedly)
> language-dependent hooks for cpp builtins be called if the
> pre-processor is called stand-alone?

The preprocessor, whether invoked through cpp or gcc driver, is still
the C (or C++) FE, and when it doesn't preprocess with -x assembler-with-cpp,
it still preprocesses C and has to define these.
Most of the macros <arch>-c.c defines are needed for assembler preprocessing
too, lots of things would break if there wouldn't be on x86_64 say
__x86_64__ define.
My patch disables just the clearly C/C++ specific macros,
I mean defining __vector to __attribute__((...)) where the definition has
C/C++ syntax clearly isn't very useful in assembler, and vector contextual
macro that expands sometimes to something C specific neither.

	Jakub

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Disable ppc/spu context sensitive macros for CLK_ASM preprocessing (PR preprocessor/61977)
  2015-04-01  8:40 [PATCH] Disable ppc/spu context sensitive macros for CLK_ASM preprocessing (PR preprocessor/61977) Jakub Jelinek
  2015-04-01  8:57 ` Steven Bosscher
@ 2015-04-01 12:09 ` Ulrich Weigand
  2015-04-02  3:05 ` David Edelsohn
  2 siblings, 0 replies; 5+ messages in thread
From: Ulrich Weigand @ 2015-04-01 12:09 UTC (permalink / raw)
  To: jakub; +Cc: David Edelsohn, gcc-patches

Jakub Jelinek wrote:

> The context sensitive macros are inherently C/C++ specific, so trying to
> expand them into anything when preprocessing assembler doesn't make any
> sense to me.

Makes sense.

> 2015-04-01  Jakub Jelinek  <jakub@redhat.com>
> 
> 	PR preprocessor/61977
> 	* config/rs6000/rs6000-c.c (rs6000_cpu_cpp_builtins): Don't
> 	predefine __vector/__bool/__pixel macros nor context sensitive
> 	macros for CLK_ASM.
> 	* config/spu/spu-c.c (spu_cpu_cpp_builtins): Similarly.

The SPU part is OK.

Thanks,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU/Linux compilers and toolchain
  Ulrich.Weigand@de.ibm.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Disable ppc/spu context sensitive macros for CLK_ASM preprocessing (PR preprocessor/61977)
  2015-04-01  8:40 [PATCH] Disable ppc/spu context sensitive macros for CLK_ASM preprocessing (PR preprocessor/61977) Jakub Jelinek
  2015-04-01  8:57 ` Steven Bosscher
  2015-04-01 12:09 ` Ulrich Weigand
@ 2015-04-02  3:05 ` David Edelsohn
  2 siblings, 0 replies; 5+ messages in thread
From: David Edelsohn @ 2015-04-02  3:05 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: Ulrich Weigand, GCC Patches

On Wed, Apr 1, 2015 at 4:40 AM, Jakub Jelinek <jakub@redhat.com> wrote:
> Hi!
>
> The context sensitive macros are inherently C/C++ specific, so trying to
> expand them into anything when preprocessing assembler doesn't make any
> sense to me.
>
> Ok for trunk?
>
> 2015-04-01  Jakub Jelinek  <jakub@redhat.com>
>
>         PR preprocessor/61977
>         * config/rs6000/rs6000-c.c (rs6000_cpu_cpp_builtins): Don't
>         predefine __vector/__bool/__pixel macros nor context sensitive
>         macros for CLK_ASM.
>         * config/spu/spu-c.c (spu_cpu_cpp_builtins): Similarly.

Okay.

Thanks, David

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-04-02  3:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-01  8:40 [PATCH] Disable ppc/spu context sensitive macros for CLK_ASM preprocessing (PR preprocessor/61977) Jakub Jelinek
2015-04-01  8:57 ` Steven Bosscher
2015-04-01  9:13   ` Jakub Jelinek
2015-04-01 12:09 ` Ulrich Weigand
2015-04-02  3:05 ` David Edelsohn

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).