This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


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

Re: Patch: Re: glimits.h is not compatible with -traditional


> On Fri, Sep 01, 2000 at 10:12:10PM -0300, Alexandre Oliva wrote:
> > > +#ifdef __STDC__
> > >  #define UINT_MAX (INT_MAX * 2U + 1)
> > > +#else
> > > +#define UINT_MAX ((unsigned)INT_MAX * 2 + 1)
> > > +#endif
> 
> I think you'll just have to ignore this warning.  There is no
> correct solution, as far as I can see.

I think the following is the best compromise given the limitations of
traditional C.

Dave
-- 
J. David Anglin                                  dave.anglin@nrc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6605)

2000-09-02  J. David Anglin  <dave@hiauly1.hia.nrc.ca>

	* glimits.h:  Make compatible with `-traditional'.

--- glimits.h.orig	Thu Jul 20 20:47:27 2000
+++ glimits.h	Sat Sep  2 02:35:50 2000
@@ -59,7 +59,11 @@
 
 /* Maximum value an `unsigned int' can hold.  (Minimum is 0).  */
 #undef UINT_MAX
+#ifdef __STDC__
 #define UINT_MAX (INT_MAX * 2U + 1)
+#else
+#define UINT_MAX (INT_MAX * 2 + 1)
+#endif
 
 /* Minimum and maximum values a `signed long int' can hold.
    (Same as `int').  */
@@ -77,8 +81,13 @@
 
 /* Maximum value an `unsigned long int' can hold.  (Minimum is 0).  */
 #undef ULONG_MAX
+#ifdef __STDC__
 #define ULONG_MAX (LONG_MAX * 2UL + 1)
+#else
+#define ULONG_MAX (LONG_MAX * 2 + 1)
+#endif
 
+#ifdef __STDC__
 #ifndef __LONG_LONG_MAX__
 #define __LONG_LONG_MAX__ 9223372036854775807LL
 #endif
@@ -106,6 +115,7 @@
 #undef ULONG_LONG_MAX
 #define ULONG_LONG_MAX (LONG_LONG_MAX * 2ULL + 1)
 #endif
+#endif /* __STDC__ */
 
 #endif /* _MACH_MACHLIMITS_H_ */
 #endif /* _LIMITS_H___ */

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