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]
Other format: [Raw text]

[commit] Always define the macros (when not defined)


Hello,

This simplifies a little part of the gdbarch stuff, changing:

-#if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (TARGET_ARCHITECTURE)
#define TARGET_ARCHITECTURE (gdbarch_bfd_arch_info (current_gdbarch))
#endif
-#endif


to:

+#if !defined (TARGET_ARCHITECTURE)
 #define TARGET_ARCHITECTURE (gdbarch_bfd_arch_info (current_gdbarch))
 #endif

the old convoluted condition dates back to when many many things were still relying on #ifdef.

The simplification doesn't affect multi-arch targets. It does affect the sparc-elf, which hasn't yet quite made it though - recent changes broke its build and this helps fix it (besides, I needed an excuse for simplifying gdbarch.sh a little :-).

committed,
Andrew
2003-05-30  Andrew Cagney  <cagney@redhat.com>

	* gdbarch.sh: Regardless of the multi-arch level, always define
	the macro when not already defined.
	* gdbarch.h, gdbarch.c: Re-generate.

Index: gdbarch.sh
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.sh,v
retrieving revision 1.237
diff -u -r1.237 gdbarch.sh
--- gdbarch.sh	17 May 2003 05:59:58 -0000	1.237
+++ gdbarch.sh	31 May 2003 03:14:12 -0000
@@ -853,11 +853,9 @@
 	printf "#if (GDB_MULTI_ARCH ${gt_level}) && 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 ${gt_level}) || !defined (${macro})\n"
+	printf "#if !defined (${macro})\n"
 	printf "#define ${macro} (gdbarch_${function} (current_gdbarch))\n"
 	printf "#endif\n"
-	printf "#endif\n"
     fi
 done
 
@@ -924,18 +922,9 @@
 	printf "#if (GDB_MULTI_ARCH ${gt_level}) && defined (${macro})\n"
 	printf "#error \"Non multi-arch definition of ${macro}\"\n"
 	printf "#endif\n"
-	if test "${level}" = ""
-	then
-	    printf "#if !defined (${macro})\n"
-	    printf "#define ${macro} (gdbarch_${function} (current_gdbarch))\n"
-	    printf "#endif\n"
-	else
-	    printf "#if GDB_MULTI_ARCH\n"
-	    printf "#if (GDB_MULTI_ARCH ${gt_level}) || !defined (${macro})\n"
-	    printf "#define ${macro} (gdbarch_${function} (current_gdbarch))\n"
-	    printf "#endif\n"
-	    printf "#endif\n"
-	fi
+	printf "#if !defined (${macro})\n"
+	printf "#define ${macro} (gdbarch_${function} (current_gdbarch))\n"
+	printf "#endif\n"
     fi
     if class_is_function_p
     then
@@ -982,8 +971,16 @@
 	    printf "#if (GDB_MULTI_ARCH ${gt_level}) && 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 ${gt_level}) || !defined (${macro})\n"
+	    if [ "x${actual}" = "x" ]
+	    then
+		d="#define ${macro}() (gdbarch_${function} (current_gdbarch))"
+	    elif [ "x${actual}" = "x-" ]
+	    then
+		d="#define ${macro} (gdbarch_${function} (current_gdbarch))"
+	    else
+		d="#define ${macro}(${actual}) (gdbarch_${function} (current_gdbarch, ${actual}))"
+	    fi
+	    printf "#if !defined (${macro})\n"
 	    if [ "x${actual}" = "x" ]
 	    then
 		printf "#define ${macro}() (gdbarch_${function} (current_gdbarch))\n"
@@ -993,7 +990,6 @@
 	    else
 		printf "#define ${macro}(${actual}) (gdbarch_${function} (current_gdbarch, ${actual}))\n"
 	    fi
-	    printf "#endif\n"
 	    printf "#endif\n"
 	fi
     fi

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