This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


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

[patch] treat conflicting multi-arch macros as an error


Per other e-mail.  This should cause a compilation failure when there is 
a conflicting multi-arch macro definition.

	Andrew
2001-06-17  Andrew Cagney  <ac131313@redhat.com>
  
	* gdbarch.sh: Generate an error when conflicting macro
	definitions.  Generate an error when both pure multi-arch and
	"tm.h".
	* gdbarch.h, gdbarch.c: Regenerate.
	* defs.h (GDB_MULTI_ARCH_TM): Rewrite definition.

Index: defs.h
===================================================================
RCS file: /cvs/src/src/gdb/defs.h,v
retrieving revision 1.54
diff -p -r1.54 defs.h
*** defs.h	2001/06/15 22:10:21	1.54
--- defs.h	2001/06/17 17:41:15
***************
*** 73,81 ****
  
  #define GDB_MULTI_ARCH_PARTIAL 1
  
! /* The target is multi-arched.  The MULTI-ARCH vector provides all
!    definitions.  "tm.h" is included and may provide definitions of
!    non- multi-arch macros..  */
  
  #define GDB_MULTI_ARCH_TM 2
  
--- 73,84 ----
  
  #define GDB_MULTI_ARCH_PARTIAL 1
  
! /* The target is partially multi-arched. Both the multi-arch vector
!    and "tm.h" provide definitions. "tm.h" cannot override a definition
!    provided by the multi-arch vector.  It is detected as a compilation
!    error.
! 
!    This setting is only useful during a multi-arch conversion. */
  
  #define GDB_MULTI_ARCH_TM 2
  
Index: gdbarch.sh
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.sh,v
retrieving revision 1.71
diff -p -r1.71 gdbarch.sh
*** gdbarch.sh	2001/06/16 20:00:24	1.71
--- gdbarch.sh	2001/06/17 17:41:26
*************** extern struct gdbarch *current_gdbarch;
*** 653,658 ****
--- 653,662 ----
  #error "FRAME_FIND_SAVED_REGS: replaced by FRAME_INIT_SAVED_REGS"
  #endif
  #endif
+ 
+ #if (GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PURE) && defined (GDB_TM_FILE)
+ #error "GDB_TM_FILE: Pure multi-arch targets do not have a tm.h file."
+ #endif
  EOF
  
  # function typedef's
*************** do
*** 666,671 ****
--- 670,678 ----
  	printf "\n"
  	printf "extern ${returntype} gdbarch_${function} (struct gdbarch *gdbarch);\n"
  	printf "/* set_gdbarch_${function}() - not applicable - pre-initialized. */\n"
+ 	printf "#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (${macro})\n"
+ 	printf "#error Non multi-arch definition of ${macro}\n"
+ 	printf "#endif\n"
  	printf "#if GDB_MULTI_ARCH\n"
  	printf "#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (${macro})\n"
  	printf "#define ${macro} (gdbarch_${function} (current_gdbarch))\n"
*************** do
*** 712,717 ****
--- 719,727 ----
  	    printf "#endif\n"
  	    printf "\n"
  	    printf "extern int gdbarch_${function}_p (struct gdbarch *gdbarch);\n"
+ 	    printf "#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (${macro}_P)\n"
+ 	    printf "#error Non multi-arch definition of ${macro}\n"
+ 	    printf "#endif\n"
  	    printf "#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (${macro}_P)\n"
  	    printf "#define ${macro}_P() (gdbarch_${function}_p (current_gdbarch))\n"
  	    printf "#endif\n"
*************** do
*** 731,736 ****
--- 741,749 ----
  	printf "\n"
  	printf "extern ${returntype} gdbarch_${function} (struct gdbarch *gdbarch);\n"
  	printf "extern void set_gdbarch_${function} (struct gdbarch *gdbarch, ${returntype} ${function});\n"
+ 	printf "#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (${macro})\n"
+ 	printf "#error Non multi-arch definition of ${macro}\n"
+ 	printf "#endif\n"
  	printf "#if GDB_MULTI_ARCH\n"
  	printf "#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (${macro})\n"
  	printf "#define ${macro} (gdbarch_${function} (current_gdbarch))\n"
*************** do
*** 774,779 ****
--- 787,795 ----
  	printf "extern void set_gdbarch_${function} (struct gdbarch *gdbarch, gdbarch_${function}_ftype *${function});\n"
  	if class_is_multiarch_p ; then :
  	else
+ 	    printf "#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (${macro})\n"
+ 	    printf "#error Non multi-arch definition of ${macro}\n"
+ 	    printf "#endif\n"
  	    printf "#if GDB_MULTI_ARCH\n"
  	    printf "#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (${macro})\n"
  	    if [ "x${actual}" = "x" ]

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