aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2001-10-02 05:59:56 +0000
committerAlan Modra <amodra@gmail.com>2001-10-02 05:59:56 +0000
commit7812ae365bca48f7e0dc30873c92252e56a70dde (patch)
tree287e12784607f2630171e2366a6d1a9fbd397126 /include
parent8c96f6f4c86f5fc264796073cf8e6675f19bc5f6 (diff)
downloadgdb-7812ae365bca48f7e0dc30873c92252e56a70dde.zip
gdb-7812ae365bca48f7e0dc30873c92252e56a70dde.tar.gz
gdb-7812ae365bca48f7e0dc30873c92252e56a70dde.tar.bz2
* common.h (NLM_CAT, NLM_CAT3): Don't define.
(NLM_CAT4): Update conditions under which this is defined. Document why CONCAT4 can't be used.
Diffstat (limited to 'include')
-rw-r--r--include/nlm/ChangeLog6
-rw-r--r--include/nlm/common.h51
2 files changed, 31 insertions, 26 deletions
diff --git a/include/nlm/ChangeLog b/include/nlm/ChangeLog
index d9ea3d0..979b162 100644
--- a/include/nlm/ChangeLog
+++ b/include/nlm/ChangeLog
@@ -1,3 +1,9 @@
+2001-10-02 Alan Modra <amodra@bigpond.net.au>
+
+ * common.h (NLM_CAT, NLM_CAT3): Don't define.
+ (NLM_CAT4): Update conditions under which this is defined. Document
+ why CONCAT4 can't be used.
+
Fri May 6 13:31:04 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
* external.h (nlmNAME(External_Custom_Header)): Add length,
diff --git a/include/nlm/common.h b/include/nlm/common.h
index 70ec186..208f4cf 100644
--- a/include/nlm/common.h
+++ b/include/nlm/common.h
@@ -1,5 +1,5 @@
/* NLM (NetWare Loadable Module) support for BFD.
- Copyright 1993 Free Software Foundation, Inc.
+ Copyright 1993, 2001 Free Software Foundation, Inc.
Written by Fred Fish @ Cygnus Support
@@ -23,31 +23,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* This file is part of NLM support for BFD, and contains the portions
that are common to both the internal and external representations. */
-/* Semi-portable string concatenation in cpp.
- The NLM_CAT4 hack is to avoid a problem with some strict ANSI C
- preprocessors. The problem is, "32_" or "64_" are not a valid
- preprocessing tokens, and we don't want extra underscores (e.g.,
- "nlm_32_"). The XNLM_CAT2 macro will cause the inner NLM_CAT macros
- to be evaluated first, producing still-valid pp-tokens. Then the
- final concatenation can be done. (Sigh.) */
-
-#ifdef SABER
-# define NLM_CAT(a,b) a##b
-# define NLM_CAT3(a,b,c) a##b##c
-# define NLM_CAT4(a,b,c,d) a##b##c##d
-#else
-# ifdef __STDC__
-# define NLM_CAT(a,b) a##b
-# define NLM_CAT3(a,b,c) a##b##c
-# define XNLM_CAT2(a,b) NLM_CAT(a,b)
-# define NLM_CAT4(a,b,c,d) XNLM_CAT2(NLM_CAT(a,b),NLM_CAT(c,d))
-# else
-# define NLM_CAT(a,b) a/**/b
-# define NLM_CAT3(a,b,c) a/**/b/**/c
-# define NLM_CAT4(a,b,c,d) a/**/b/**/c/**/d
-# endif
-#endif
-
/* If NLM_ARCH_SIZE is not defined, default to 32. NLM_ARCH_SIZE is
optionally defined by the application. */
@@ -55,6 +30,30 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
# define NLM_ARCH_SIZE 32
#endif
+/* Due to horrible details of ANSI macro expansion, we can't use CONCAT4
+ for NLM_NAME. CONCAT2 is used in BFD_JUMP_TABLE macros, and some of
+ them will expand to tokens that themselves are macros defined in terms
+ of NLM_NAME. If NLM_NAME were defined using CONCAT4 (which is itself
+ defined in bfd-in.h using CONCAT2), ANSI preprocessor rules say that
+ the CONCAT2 within NLM_NAME should not be expanded.
+ So use another name. */
+#if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
+#ifdef SABER
+#define NLM_CAT4(a,b,c,d) a##b##c##d
+#else
+/* This hack is to avoid a problem with some strict ANSI C preprocessors.
+ The problem is, "32_" is not a valid preprocessing token, and we don't
+ want extra underscores (e.g., "nlm_32_"). The NLM_XCAT2 macro will
+ cause the inner CAT2 macros to be evaluated first, producing
+ still-valid pp-tokens. Then the final concatenation can be done. */
+#define NLM_CAT2(a,b) a##b
+#define NLM_XCAT2(a,b) NLM_CAT2(a,b)
+#define NLM_CAT4(a,b,c,d) NLM_XCAT2(NLM_CAT2(a,b),NLM_CAT2(c,d))
+#endif
+#else
+#define NLM_CAT4(a,b,c,d) a/**/b/**/c/**/d
+#endif
+
#if NLM_ARCH_SIZE == 32
# define NLM_TARGET_LONG_SIZE 4
# define NLM_TARGET_ADDRESS_SIZE 4