aboutsummaryrefslogtreecommitdiff
path: root/gdb/defs.h
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2000-03-14 02:37:25 +0000
committerAndrew Cagney <cagney@redhat.com>2000-03-14 02:37:25 +0000
commit1a0559af2c9f7ca587a7d54ebb5cc9636e2246a9 (patch)
tree3d43e976b505432cd3613a19eed384dd7d3c720b /gdb/defs.h
parente40eb3e94d953fff983c8ddf6d6a1713ecf4ebc7 (diff)
downloadfsf-binutils-gdb-1a0559af2c9f7ca587a7d54ebb5cc9636e2246a9.zip
fsf-binutils-gdb-1a0559af2c9f7ca587a7d54ebb5cc9636e2246a9.tar.gz
fsf-binutils-gdb-1a0559af2c9f7ca587a7d54ebb5cc9636e2246a9.tar.bz2
Almost, but not quite, deprecate STREQ, STREQN, STRCMP and QUIT.
Diffstat (limited to 'gdb/defs.h')
-rw-r--r--gdb/defs.h26
1 files changed, 24 insertions, 2 deletions
diff --git a/gdb/defs.h b/gdb/defs.h
index 9248c76..737ef1c 100644
--- a/gdb/defs.h
+++ b/gdb/defs.h
@@ -117,8 +117,23 @@ extern int core_addr_greaterthan (CORE_ADDR lhs, CORE_ADDR rhs);
#define max(a, b) ((a) > (b) ? (a) : (b))
#endif
-/* Gdb does *lots* of string compares. Use macros to speed them up by
- avoiding function calls if the first characters are not the same. */
+/* Macros to do string compares.
+
+ NOTE: cagney/2000-03-14:
+
+ While old code can continue to refer to these macros, new code is
+ probably better off using strcmp() directly vis: ``strcmp() == 0''
+ and ``strcmp() != 0''.
+
+ This is because modern compilers can directly inline strcmp()
+ making the original justification for these macros - avoid function
+ call overhead by pre-testing the first characters
+ (``*X==*Y?...:0'') - redundant.
+
+ ``Even if [...] testing the first character does have a modest
+ performance improvement, I'd rather that whenever a performance
+ issue is found that we spend the effort on algorithmic
+ optimizations than micro-optimizing.'' J.T. */
#define STRCMP(a,b) (*(a) == *(b) ? strcmp ((a), (b)) : (int)*(a) - (int)*(b))
#define STREQ(a,b) (*(a) == *(b) ? !strcmp ((a), (b)) : 0)
@@ -153,6 +168,13 @@ extern int sevenbit_strings;
extern void quit (void);
+/* FIXME: cagney/2000-03-13: It has been suggested that the peformance
+ benefits of having a ``QUIT'' macro rather than a function are
+ marginal. If the overhead of a QUIT function call is proving
+ significant then its calling frequency should probably be reduced
+ [kingdon]. A profile analyzing the current situtation is
+ needed. */
+
#ifdef QUIT
/* do twice to force compiler warning */
#define QUIT_FIXME "FIXME"