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]

[RFA:] CPP: Move REGISTER_PREFIX out of initializers.


IMHO assembly syntax variant support is flawed as long as
REGISTER_PREFIX must be constant, not a C expression like
USER_LABEL_PREFIX.  It's true that for a non-integrated cpp, you
can't examine target_flags, but that issue is outside the scope
of this patch, which is only to move REGISTER_PREFIX out of
initializers.

On a related issue, I was trying to fix a bug that is seen
because REGISTER_PREFIX is "$" for my target, in the somewhat
ungraceful handling of the internal expansion that looks like
"#define __REGISTER_PREFIX__ $", but I sheepishly settled for
papering over it by adding "-$" to CPP_OPTIONS.  Internal
expansions should IMHO be handled in some way overriding
warnings and pedantic-errors, but it's not apparent to me how to
fix that.

Bootstrapped on i686-pc-linux-gnu with no regressions.

Ok to commit?

	Handle REGISTER_PREFIX being a C expression, not a constant.
	* cppinit.c (REGPREFIX): New.
	(builtin_array) <__REGISTER_PREFIX__>: Use X and REGPREFIX.
	(initialize_builtins): Handle REGPREFIX similar to ULP.

Index: cppinit.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cppinit.c,v
retrieving revision 1.113
diff -c -p -r1.113 cppinit.c
*** cppinit.c	2000/10/30 22:28:59	1.113
--- cppinit.c	2000/11/09 03:07:32
*************** cpp_cleanup (pfile)
*** 547,552 ****
--- 547,553 ----
     them in the FLAGS field instead:
     VERS		value is the global version_string, quoted
     ULP		value is the global user_label_prefix
+    REGPREFIX	value is the REGISTER_PREFIX expression
  
     Also, macros with CPLUS set in the flags field are entered only for C++.  */
  
*************** struct builtin
*** 564,569 ****
--- 565,571 ----
  #define CPLUS		0x04
  #define BUILTIN		0x08
  #define OPERATOR  	0x10
+ #define REGPREFIX	0x20
  
  #define B(n, t)       { U n, 0, t, 0, BUILTIN, sizeof n - 1 }
  #define C(n, v)       { U n, v, 0, 0, 0, sizeof n - 1 }
*************** static const struct builtin builtin_arra
*** 581,587 ****
  
    X("__VERSION__",		VERS),
    X("__USER_LABEL_PREFIX__",	ULP),
!   C("__REGISTER_PREFIX__",	REGISTER_PREFIX),
    C("__HAVE_BUILTIN_SETJMP__",	"1"),
  #ifndef NO_BUILTIN_SIZE_TYPE
    C("__SIZE_TYPE__",		SIZE_TYPE),
--- 583,589 ----
  
    X("__VERSION__",		VERS),
    X("__USER_LABEL_PREFIX__",	ULP),
!   X("__REGISTER_PREFIX__",	REGPREFIX),
    C("__HAVE_BUILTIN_SETJMP__",	"1"),
  #ifndef NO_BUILTIN_SIZE_TYPE
    C("__SIZE_TYPE__",		SIZE_TYPE),
*************** initialize_builtins (pfile)
*** 661,666 ****
--- 663,670 ----
  	    {
  	      if (b->flags & ULP)
  		val = CPP_OPTION (pfile, user_label_prefix);
+ 	      else if (b->flags & REGPREFIX)
+ 		val = REGISTER_PREFIX;
  	      else
  		val = b->value;
  
*************** initialize_builtins (pfile)
*** 678,683 ****
--- 682,688 ----
  #undef VERS
  #undef ULP
  #undef CPLUS
+ #undef REGPREFIX
  #undef builtin_array_end
  
  /* Another subroutine of cpp_start_read.  This one sets up to do

brgds, H-P

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