This is the mail archive of the gdb-patches@sourceware.org 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]

[RFA/commit] Delete MAX_OF_TYPE/MIN_OF_TYPE macros.


Hello,

These macros are actually no longer used, nor can they work anymore
(we are missing the definition MAX_OF_SIZE/UMAX_OF_SIZE/MIN_OF_SIZE/
UMIN_OF_SIZE).  And I think it's been like that for quite some time.
So I propose we get rid of them.

A couple of remarks, however:

  - Some commented out code in m2-exp.y references them. But this code
    has been disabled since at least day 1 of public CVS, which was
    about 12 years ago;

  - I noticed thanks to a comment in ada-lang mentioning these macros
    that we have some static routines there that return that information.
    Perhaps we could move them somewhere more common-place.
    But since we are the only location that I know of, I've left things
    as they are for now.

2010-04-24  Joel Brobecker  <brobecker@adacore.com>

        * gdbtypes.h (MAX_OF_TYPE, MIN_OF_TYPE): Delete macros.
        * ada-lang.c: Remove comment mentioning these macros.
        * m2-exp.y: Delete commented out code.

Tested on x86_64-linux, no regression. Any objection?

---
 gdb/ada-lang.c |    5 -----
 gdb/gdbtypes.h |   10 ----------
 gdb/m2-exp.y   |   16 ----------------
 3 files changed, 0 insertions(+), 31 deletions(-)

diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 9da0609..76dfa96 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -527,11 +527,6 @@ check_size (const struct type *type)
     error (_("object size is larger than varsize-limit"));
 }
 
-
-/* Note: would have used MAX_OF_TYPE and MIN_OF_TYPE macros from
-   gdbtypes.h, but some of the necessary definitions in that file
-   seem to have gone missing. */
-
 /* Maximum value of a SIZE-byte signed integer type. */
 static LONGEST
 max_of_size (int size)
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index 4d26f5a..3141857 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -1185,16 +1185,6 @@ extern const struct floatformat *floatformats_vax_d[BFD_ENDIAN_UNKNOWN];
 extern const struct floatformat *floatformats_ibm_long_double[BFD_ENDIAN_UNKNOWN];
 
 
-/* Maximum and minimum values of built-in types */
-
-#define	MAX_OF_TYPE(t)	\
-   (TYPE_UNSIGNED(t) ? UMAX_OF_SIZE(TYPE_LENGTH(t)) \
-    : MAX_OF_SIZE(TYPE_LENGTH(t)))
-
-#define MIN_OF_TYPE(t)	\
-   (TYPE_UNSIGNED(t) ? UMIN_OF_SIZE(TYPE_LENGTH(t)) \
-    : MIN_OF_SIZE(TYPE_LENGTH(t)))
-
 /* Allocate space for storing data associated with a particular type.
    We ensure that the space is allocated using the same mechanism that
    was used to allocate the space for the type structure itself.  I.E.
diff --git a/gdb/m2-exp.y b/gdb/m2-exp.y
index 38bc7cc..3baff79 100644
--- a/gdb/m2-exp.y
+++ b/gdb/m2-exp.y
@@ -651,22 +651,6 @@ type
 
 %%
 
-#if 0  /* FIXME! */
-int
-overflow(a,b)
-   long a,b;
-{
-   return (MAX_OF_TYPE(parse_m2_type->builtin_int) - b) < a;
-}
-
-int
-uoverflow(a,b)
-   unsigned long a,b;
-{
-   return (MAX_OF_TYPE(parse_m2_type->builtin_card) - b) < a;
-}
-#endif /* FIXME */
-
 /* Take care of parsing a number (anything that starts with a digit).
    Set yylval and return the token type; update lexptr.
    LEN is the number of characters in it.  */
-- 
1.6.3.3


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