public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
* Support for long long type for C99 and C++11 compliant compilers
@ 2014-09-09 18:06 Thomas Uhle
  2014-10-09 12:34 ` Corinna Vinschen
  0 siblings, 1 reply; 7+ messages in thread
From: Thomas Uhle @ 2014-09-09 18:06 UTC (permalink / raw)
  To: Newlib Mailing List

[-- Attachment #1: Type: text/plain, Size: 532 bytes --]

Hello,

the attached patch fixes some issues with long long type support for
compilers that have C99 or C++11 compliance. For instance, llabs(),
lldiv() and atoll() have been missing if g++ was invoked with option
'-std=c++11'.

Regards,

Thomas Uhle


-- 
Thomas Uhle
System Specification Mixed-Signal Systems
Fraunhofer Institute for Integrated Circuits IIS
Design Automation Division EAS
Zeunerstr. 38, 01069 Dresden, Germany
phone: +49 (0) 351 4640-786
mailto:thomas.uhle@eas.iis.fraunhofer.de
http://www.eas.iis.fraunhofer.de/

[-- Attachment #2: newlib_long_long_support.diff --]
[-- Type: text/x-patch, Size: 5288 bytes --]

--- newlib/libc/include/math.h	27 Aug 2014 19:27:03 -0000	1.52
+++ newlib/libc/include/math.h	9 Sep 2014 17:37:27 -0000
@@ -136,7 +136,8 @@
 #endif /* ! defined (__math_68881) */
 #endif /* ! defined (_REENT_ONLY) */
 
-#if !defined(__STRICT_ANSI__) || defined(__cplusplus) || __STDC_VERSION__ >= 199901L
+#if !defined(__STRICT_ANSI__) || defined(__cplusplus) || \
+  (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L)
 
 /* ISO C99 types and macros. */
 
@@ -276,7 +277,7 @@
 extern _LONG_LONG_TYPE int llrint _PARAMS((double));
 extern double round _PARAMS((double));
 extern long int lround _PARAMS((double));
-extern long long int llround _PARAMS((double));
+extern _LONG_LONG_TYPE int llround _PARAMS((double));
 extern double trunc _PARAMS((double));
 extern double remquo _PARAMS((double, double, int *));
 extern double fdim _PARAMS((double, double));
@@ -343,10 +344,10 @@
 extern float tgammaf _PARAMS((float));
 extern float nearbyintf _PARAMS((float));
 extern long int lrintf _PARAMS((float));
-extern _LONG_LONG_TYPE llrintf _PARAMS((float));
+extern _LONG_LONG_TYPE int llrintf _PARAMS((float));
 extern float roundf _PARAMS((float));
 extern long int lroundf _PARAMS((float));
-extern long long int llroundf _PARAMS((float));
+extern _LONG_LONG_TYPE int llroundf _PARAMS((float));
 extern float truncf _PARAMS((float));
 extern float remquof _PARAMS((float, float, int *));
 extern float fdimf _PARAMS((float, float));
@@ -429,7 +430,7 @@
 extern long double tgammal _PARAMS((long double));
 extern long double nearbyintl _PARAMS((long double));
 extern long int lrintl _PARAMS((long double));
-extern long long int llrintl _PARAMS((long double));
+extern _LONG_LONG_TYPE int llrintl _PARAMS((long double));
 extern long double roundl _PARAMS((long double));
 extern long lroundl _PARAMS((long double));
 extern _LONG_LONG_TYPE int llroundl _PARAMS((long double));
@@ -452,11 +453,11 @@
 /* Other long double precision functions.  */
 extern _LONG_DOUBLE rintl _PARAMS((_LONG_DOUBLE));
 extern long int lrintl _PARAMS((_LONG_DOUBLE));
-extern _LONG_LONG_TYPE llrintl _PARAMS((_LONG_DOUBLE));
+extern _LONG_LONG_TYPE int llrintl _PARAMS((_LONG_DOUBLE));
 #endif /* __i386__ */
 #endif /* !_LDBL_EQ_DBL */
 
-#endif /* !defined (__STRICT_ANSI__) || defined(__cplusplus) || __STDC_VERSION__ >= 199901L */
+#endif /* !defined (__STRICT_ANSI__) || defined(__cplusplus) || (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) */
 
 #if !defined (__STRICT_ANSI__) || defined(__cplusplus)
 
--- newlib/libc/include/stdlib.h	1 Aug 2014 15:44:50 -0000	1.51
+++ newlib/libc/include/stdlib.h	9 Sep 2014 17:37:27 -0000
@@ -130,7 +130,9 @@
 _VOID	_EXFUN(srand,(unsigned __seed));
 double	_EXFUN(strtod,(const char *__restrict __n, char **__restrict __end_PTR));
 double	_EXFUN(_strtod_r,(struct _reent *,const char *__restrict __n, char **__restrict __end_PTR));
-#if !defined(__STRICT_ANSI__) || (__STDC_VERSION__ >= 199901L) || (__cplusplus >= 201103L)
+#if !defined(__STRICT_ANSI__) || \
+  (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || \
+  (defined(__cplusplus) && __cplusplus >= 201103L)
 float	_EXFUN(strtof,(const char *__restrict __n, char **__restrict __end_PTR));
 #endif
 #ifndef __STRICT_ANSI__
@@ -189,18 +191,28 @@
        _EXFUN(_seed48_r,(struct _reent *, unsigned short [3]));
 _VOID  _EXFUN(srand48,(long));
 _VOID  _EXFUN(_srand48_r,(struct _reent *, long));
+#endif /* ! __STRICT_ANSI__ */
+#if !defined(__STRICT_ANSI__) || \
+  (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || \
+  (defined(__cplusplus) && __cplusplus >= 201103L)
 long long _EXFUN(atoll,(const char *__nptr));
+#endif
+#ifndef __STRICT_ANSI__
 long long _EXFUN(_atoll_r,(struct _reent *, const char *__nptr));
+#endif /* ! __STRICT_ANSI__ */
+#if !defined(__STRICT_ANSI__) || \
+  (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || \
+  (defined(__cplusplus) && __cplusplus >= 201103L)
 long long _EXFUN(llabs,(long long));
 lldiv_t	_EXFUN(lldiv,(long long __numer, long long __denom));
-#endif /* ! __STRICT_ANSI__ */
-#if !defined(__STRICT_ANSI__) || (__STDC_VERSION__ >= 199901L) || (__cplusplus >= 201103L)
 long long _EXFUN(strtoll,(const char *__restrict __n, char **__restrict __end_PTR, int __base));
 #endif
 #ifndef __STRICT_ANSI__
 long long _EXFUN(_strtoll_r,(struct _reent *, const char *__restrict __n, char **__restrict __end_PTR, int __base));
 #endif /* ! __STRICT_ANSI__ */
-#if !defined(__STRICT_ANSI__) || (__STDC_VERSION__ >= 199901L) || (__cplusplus >= 201103L)
+#if !defined(__STRICT_ANSI__) || \
+  (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || \
+  (defined(__cplusplus) && __cplusplus >= 201103L)
 unsigned long long _EXFUN(strtoull,(const char *__restrict __n, char **__restrict __end_PTR, int __base));
 #endif
 #ifndef __STRICT_ANSI__
@@ -232,7 +244,9 @@
 
 /* On platforms where long double equals double.  */
 #ifdef _HAVE_LONG_DOUBLE
-#if !defined(__STRICT_ANSI__) || (__STDC_VERSION__ >= 199901L) || (__cplusplus >= 201103L)
+#if !defined(__STRICT_ANSI__) || \
+  (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || \
+  (defined(__cplusplus) && __cplusplus >= 201103L)
 extern long double strtold (const char *__restrict, char **__restrict);
 #endif
 #endif /* _HAVE_LONG_DOUBLE */

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Support for long long type for C99 and C++11 compliant compilers
  2014-09-09 18:06 Support for long long type for C99 and C++11 compliant compilers Thomas Uhle
@ 2014-10-09 12:34 ` Corinna Vinschen
  2014-10-09 14:20   ` Thomas Uhle
  0 siblings, 1 reply; 7+ messages in thread
From: Corinna Vinschen @ 2014-10-09 12:34 UTC (permalink / raw)
  To: newlib

[-- Attachment #1: Type: text/plain, Size: 663 bytes --]

Hi Thomas,

On Sep  9 20:05, Thomas Uhle wrote:
> Hello,
> 
> the attached patch fixes some issues with long long type support for
> compilers that have C99 or C++11 compliance. For instance, llabs(),
> lldiv() and atoll() have been missing if g++ was invoked with option
> '-std=c++11'.

Your patch is missing a ChangeLog entry.  Also, why do you replace "long
long" with _LONG_LONG_TYPE?  Isn't _LONG_LONG_TYPE always "long long"?
Also, while you're doing this in math.h, you're sticking to "long long"
for other declarations like for atoll.

What's the reasoning here?


Thanks,
Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat

[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Support for long long type for C99 and C++11 compliant compilers
  2014-10-09 12:34 ` Corinna Vinschen
@ 2014-10-09 14:20   ` Thomas Uhle
  2014-10-09 16:53     ` Corinna Vinschen
  0 siblings, 1 reply; 7+ messages in thread
From: Thomas Uhle @ 2014-10-09 14:20 UTC (permalink / raw)
  To: newlib

On Thu, 2014-10-09 at 14:34 +0200, Corinna Vinschen wrote:

> Hi Thomas,
> 
> On Sep  9 20:05, Thomas Uhle wrote:
> > Hello,
> > 
> > the attached patch fixes some issues with long long type support for
> > compilers that have C99 or C++11 compliance. For instance, llabs(),
> > lldiv() and atoll() have been missing if g++ was invoked with option
> > '-std=c++11'.
> 
> Your patch is missing a ChangeLog entry.  Also, why do you replace "long
> long" with _LONG_LONG_TYPE?  Isn't _LONG_LONG_TYPE always "long long"?
> Also, while you're doing this in math.h, you're sticking to "long long"
> for other declarations like for atoll.
> 
> What's the reasoning here?


Hi Corinna,

thanks for your reply!  The macro _LONG_LONG_TYPE has been used rather
inconsistently through math.h, for llroundl() it is _LONG_LONG_TYPE, for
llroundf() it is "long long" for instance. I just tried to get its usage
aligned for all of these functions. As far as I can see, _LONG_LONG_TYPE
is only used in math.h, nowhere else. That is why I did not touch
anything else. And _LONG_LONG_TYPE is defined in _ansi.h to be "long
long" if _HAVE_STDC is defined and to be just "long" if _HAVE_STDC is
not defined. I do not know the rationale, but it seems that it has been
there since the time of the following entry in the ChangeLog:

| 2007-12-19  Dave Korn  <dave.korn@artimi.com>
|             Jeff Johnston  <jjohnstn@redhhat.com>
| 
|         * libc/include/_ansi.h: Add _LONG_LONG definition.
|         * libc/include/math.h (llrint, llrintf, rintl, lrintl, llrintl): Add
|         prototypes.

I could perfectly live without _LONG_LONG_TYPE, though. But I do not
know whether replacing _LONG_LONG_TYPE by "long long" does break things
on any other platform. That is why ...

Surely I can send an update of the patch that is also adding an entry to
the ChangeLog once you have decided how to get along with
_LONG_LONG_TYPE. So just let me know ...

Best regards,

Thomas


-- 
Thomas Uhle
System Specification Mixed-Signal Systems
Fraunhofer Institute for Integrated Circuits IIS
Design Automation Division EAS
Zeunerstr. 38, 01069 Dresden, Germany
phone: +49 (0) 351 4640-786
mailto:thomas.uhle@eas.iis.fraunhofer.de
http://www.eas.iis.fraunhofer.de/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Support for long long type for C99 and C++11 compliant compilers
  2014-10-09 14:20   ` Thomas Uhle
@ 2014-10-09 16:53     ` Corinna Vinschen
  2014-10-09 18:06       ` Jeff Johnston
  0 siblings, 1 reply; 7+ messages in thread
From: Corinna Vinschen @ 2014-10-09 16:53 UTC (permalink / raw)
  To: newlib

[-- Attachment #1: Type: text/plain, Size: 2791 bytes --]

On Oct  9 16:20, Thomas Uhle wrote:
> On Thu, 2014-10-09 at 14:34 +0200, Corinna Vinschen wrote:
> 
> > Hi Thomas,
> > 
> > On Sep  9 20:05, Thomas Uhle wrote:
> > > Hello,
> > > 
> > > the attached patch fixes some issues with long long type support for
> > > compilers that have C99 or C++11 compliance. For instance, llabs(),
> > > lldiv() and atoll() have been missing if g++ was invoked with option
> > > '-std=c++11'.
> > 
> > Your patch is missing a ChangeLog entry.  Also, why do you replace "long
> > long" with _LONG_LONG_TYPE?  Isn't _LONG_LONG_TYPE always "long long"?
> > Also, while you're doing this in math.h, you're sticking to "long long"
> > for other declarations like for atoll.
> > 
> > What's the reasoning here?
> 
> 
> Hi Corinna,
> 
> thanks for your reply!  The macro _LONG_LONG_TYPE has been used rather
> inconsistently through math.h, for llroundl() it is _LONG_LONG_TYPE, for
> llroundf() it is "long long" for instance. I just tried to get its usage
> aligned for all of these functions. As far as I can see, _LONG_LONG_TYPE
> is only used in math.h, nowhere else. That is why I did not touch
> anything else. And _LONG_LONG_TYPE is defined in _ansi.h to be "long
> long" if _HAVE_STDC is defined and to be just "long" if _HAVE_STDC is
> not defined. I do not know the rationale, but it seems that it has been
> there since the time of the following entry in the ChangeLog:
> 
> | 2007-12-19  Dave Korn  <dave.korn@artimi.com>
> |             Jeff Johnston  <jjohnstn@redhhat.com>
> | 
> |         * libc/include/_ansi.h: Add _LONG_LONG definition.
> |         * libc/include/math.h (llrint, llrintf, rintl, lrintl, llrintl): Add
> |         prototypes.
> 
> I could perfectly live without _LONG_LONG_TYPE, though. But I do not
> know whether replacing _LONG_LONG_TYPE by "long long" does break things
> on any other platform. That is why ...

That makes sense.  I'm not sure either, why _LONG_LONG_TYPE is used in
math.h and then only for the aforementioned set of functions (and even
then inconsistently, as you observed).

Jeff, I see the addition of using _LONG_LONG_TYPE is from you.  I don't
quite grok why this is done for the functions added by Dave Korn, but
not for other long long functions added later on.  It looks like an
oversight, or the importance of !_HAVE_STDC got negligible.

AFAICS, using _LONG_LONG_TYPE instead of "long long" for other functions
now might break the ABI dependend on _HAVE_STDC.  I'm not sure there's
still any compiler out there not having long long, so *if* we go in any
ABI-breaking direction, I'd prefer to get rid of _LONG_LONG_TYPE and
define the affected functions always as "long long".


Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat

[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Support for long long type for C99 and C++11 compliant compilers
  2014-10-09 16:53     ` Corinna Vinschen
@ 2014-10-09 18:06       ` Jeff Johnston
  2014-10-10 11:45         ` Thomas Uhle
  0 siblings, 1 reply; 7+ messages in thread
From: Jeff Johnston @ 2014-10-09 18:06 UTC (permalink / raw)
  To: newlib

----- Original Message -----
> From: "Corinna Vinschen" <vinschen@redhat.com>
> To: newlib@sourceware.org
> Sent: Thursday, October 9, 2014 12:53:05 PM
> Subject: Re: Support for long long type for C99 and C++11 compliant compilers
> 
> On Oct  9 16:20, Thomas Uhle wrote:
> > On Thu, 2014-10-09 at 14:34 +0200, Corinna Vinschen wrote:
> > 
> > > Hi Thomas,
> > > 
> > > On Sep  9 20:05, Thomas Uhle wrote:
> > > > Hello,
> > > > 
> > > > the attached patch fixes some issues with long long type support for
> > > > compilers that have C99 or C++11 compliance. For instance, llabs(),
> > > > lldiv() and atoll() have been missing if g++ was invoked with option
> > > > '-std=c++11'.
> > > 
> > > Your patch is missing a ChangeLog entry.  Also, why do you replace "long
> > > long" with _LONG_LONG_TYPE?  Isn't _LONG_LONG_TYPE always "long long"?
> > > Also, while you're doing this in math.h, you're sticking to "long long"
> > > for other declarations like for atoll.
> > > 
> > > What's the reasoning here?
> > 
> > 
> > Hi Corinna,
> > 
> > thanks for your reply!  The macro _LONG_LONG_TYPE has been used rather
> > inconsistently through math.h, for llroundl() it is _LONG_LONG_TYPE, for
> > llroundf() it is "long long" for instance. I just tried to get its usage
> > aligned for all of these functions. As far as I can see, _LONG_LONG_TYPE
> > is only used in math.h, nowhere else. That is why I did not touch
> > anything else. And _LONG_LONG_TYPE is defined in _ansi.h to be "long
> > long" if _HAVE_STDC is defined and to be just "long" if _HAVE_STDC is
> > not defined. I do not know the rationale, but it seems that it has been
> > there since the time of the following entry in the ChangeLog:
> > 
> > | 2007-12-19  Dave Korn  <dave.korn@artimi.com>
> > |             Jeff Johnston  <jjohnstn@redhhat.com>
> > | 
> > |         * libc/include/_ansi.h: Add _LONG_LONG definition.
> > |         * libc/include/math.h (llrint, llrintf, rintl, lrintl, llrintl):
> > |         Add
> > |         prototypes.
> > 
> > I could perfectly live without _LONG_LONG_TYPE, though. But I do not
> > know whether replacing _LONG_LONG_TYPE by "long long" does break things
> > on any other platform. That is why ...
> 
> That makes sense.  I'm not sure either, why _LONG_LONG_TYPE is used in
> math.h and then only for the aforementioned set of functions (and even
> then inconsistently, as you observed).
> 
> Jeff, I see the addition of using _LONG_LONG_TYPE is from you.  I don't
> quite grok why this is done for the functions added by Dave Korn, but
> not for other long long functions added later on.  It looks like an
> oversight, or the importance of !_HAVE_STDC got negligible.
> 
> AFAICS, using _LONG_LONG_TYPE instead of "long long" for other functions
> now might break the ABI dependend on _HAVE_STDC.  I'm not sure there's
> still any compiler out there not having long long, so *if* we go in any
> ABI-breaking direction, I'd prefer to get rid of _LONG_LONG_TYPE and
> define the affected functions always as "long long".
> 

Sure.  I'm fine with that.

> 
> Corinna
> 
> --
> Corinna Vinschen
> Cygwin Maintainer
> Red Hat
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Support for long long type for C99 and C++11 compliant compilers
  2014-10-09 18:06       ` Jeff Johnston
@ 2014-10-10 11:45         ` Thomas Uhle
  2014-10-10 14:44           ` Corinna Vinschen
  0 siblings, 1 reply; 7+ messages in thread
From: Thomas Uhle @ 2014-10-10 11:45 UTC (permalink / raw)
  To: newlib

[-- Attachment #1: Type: text/plain, Size: 512 bytes --]

2014-10-10  Thomas Uhle <thomas.uhle@eas.iis.fraunhofer.de>

	* libc/include/_ansi.h: _LONG_LONG_TYPE definition removed.
	* libc/include/math.h: _LONG_LONG_TYPE replaced by "long long".
	Guards for C99 and C++11 functions fixed.
	* libc/include/stdlib.h: Guards for C99 and C++11 functions fixed.

Signed-off-by: Thomas Uhle <thomas.uhle@eas.iis.fraunhofer.de>
---

Hi Corinna and Jeff,

this is the update of my patch, now also with a Changelog entry and
_LONG_LONG_TYPE being removed.

Best regards,

Thomas


[-- Attachment #2: Type: text/x-patch, Size: 6781 bytes --]

--- newlib/ChangeLog	9 Oct 2014 15:57:49 -0000	1.1962
+++ newlib/ChangeLog	10 Oct 2014 11:28:40 -0000
@@ -1,3 +1,10 @@
+2014-10-10  Thomas Uhle <thomas.uhle@eas.iis.fraunhofer.de>
+
+	* libc/include/_ansi.h: _LONG_LONG_TYPE definition removed.
+	* libc/include/math.h: _LONG_LONG_TYPE replaced by "long long".
+	Guards for C99 and C++11 functions fixed.
+	* libc/include/stdlib.h: Guards for C99 and C++11 functions fixed.
+
 2014-10-09  Sebastian Huber  <sebastian.huber@embedded-brains.de>
 
         * libc/include/stdint.h: Include <sys/_intsup.h>.
--- newlib/libc/include/_ansi.h	1 Aug 2014 15:44:50 -0000	1.12
+++ newlib/libc/include/_ansi.h	10 Oct 2014 11:28:40 -0000
@@ -72,9 +72,6 @@
 #ifndef _LONG_DOUBLE
 #define _LONG_DOUBLE long double
 #endif
-#ifndef _LONG_LONG_TYPE
-#define _LONG_LONG_TYPE long long
-#endif
 #ifndef _PARAMS
 #define _PARAMS(paramlist)		paramlist
 #endif
@@ -93,7 +90,6 @@
 #define	_DEFUN_VOID(name)		name()
 #define _CAST_VOID
 #define _LONG_DOUBLE double
-#define _LONG_LONG_TYPE long
 #ifndef _PARAMS
 #define _PARAMS(paramlist)		()
 #endif
--- newlib/libc/include/math.h	27 Aug 2014 19:27:03 -0000	1.52
+++ newlib/libc/include/math.h	10 Oct 2014 11:28:40 -0000
@@ -136,7 +136,8 @@
 #endif /* ! defined (__math_68881) */
 #endif /* ! defined (_REENT_ONLY) */
 
-#if !defined(__STRICT_ANSI__) || defined(__cplusplus) || __STDC_VERSION__ >= 199901L
+#if !defined(__STRICT_ANSI__) || defined(__cplusplus) || \
+  (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L)
 
 /* ISO C99 types and macros. */
 
@@ -273,7 +274,7 @@
 extern double tgamma _PARAMS((double));
 extern double nearbyint _PARAMS((double));
 extern long int lrint _PARAMS((double));
-extern _LONG_LONG_TYPE int llrint _PARAMS((double));
+extern long long int llrint _PARAMS((double));
 extern double round _PARAMS((double));
 extern long int lround _PARAMS((double));
 extern long long int llround _PARAMS((double));
@@ -343,7 +344,7 @@
 extern float tgammaf _PARAMS((float));
 extern float nearbyintf _PARAMS((float));
 extern long int lrintf _PARAMS((float));
-extern _LONG_LONG_TYPE llrintf _PARAMS((float));
+extern long long int llrintf _PARAMS((float));
 extern float roundf _PARAMS((float));
 extern long int lroundf _PARAMS((float));
 extern long long int llroundf _PARAMS((float));
@@ -432,7 +433,7 @@
 extern long long int llrintl _PARAMS((long double));
 extern long double roundl _PARAMS((long double));
 extern long lroundl _PARAMS((long double));
-extern _LONG_LONG_TYPE int llroundl _PARAMS((long double));
+extern long long int llroundl _PARAMS((long double));
 extern long double truncl _PARAMS((long double));
 extern long double remquol _PARAMS((long double, long double, int *));
 extern long double fdiml _PARAMS((long double, long double));
@@ -452,11 +453,11 @@
 /* Other long double precision functions.  */
 extern _LONG_DOUBLE rintl _PARAMS((_LONG_DOUBLE));
 extern long int lrintl _PARAMS((_LONG_DOUBLE));
-extern _LONG_LONG_TYPE llrintl _PARAMS((_LONG_DOUBLE));
+extern long long int llrintl _PARAMS((_LONG_DOUBLE));
 #endif /* __i386__ */
 #endif /* !_LDBL_EQ_DBL */
 
-#endif /* !defined (__STRICT_ANSI__) || defined(__cplusplus) || __STDC_VERSION__ >= 199901L */
+#endif /* !defined (__STRICT_ANSI__) || defined(__cplusplus) || (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) */
 
 #if !defined (__STRICT_ANSI__) || defined(__cplusplus)
 
--- newlib/libc/include/stdlib.h	1 Aug 2014 15:44:50 -0000	1.51
+++ newlib/libc/include/stdlib.h	9 Sep 2014 17:37:27 -0000
@@ -130,7 +130,9 @@
 _VOID	_EXFUN(srand,(unsigned __seed));
 double	_EXFUN(strtod,(const char *__restrict __n, char **__restrict __end_PTR));
 double	_EXFUN(_strtod_r,(struct _reent *,const char *__restrict __n, char **__restrict __end_PTR));
-#if !defined(__STRICT_ANSI__) || (__STDC_VERSION__ >= 199901L) || (__cplusplus >= 201103L)
+#if !defined(__STRICT_ANSI__) || \
+  (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || \
+  (defined(__cplusplus) && __cplusplus >= 201103L)
 float	_EXFUN(strtof,(const char *__restrict __n, char **__restrict __end_PTR));
 #endif
 #ifndef __STRICT_ANSI__
@@ -151,7 +153,13 @@
 char *  _EXFUN(l64a,(long __input));
 char *  _EXFUN(_l64a_r,(struct _reent *,long __input));
 int	_EXFUN(on_exit,(_VOID (*__func)(int, _PTR),_PTR __arg));
+#endif /* ! __STRICT_ANSI__ */
+#if !defined(__STRICT_ANSI__) || \
+  (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || \
+  (defined(__cplusplus) && __cplusplus >= 201103L)
 _VOID	_EXFUN(_Exit,(int __status) _ATTRIBUTE ((__noreturn__)));
+#endif
+#ifndef __STRICT_ANSI__
 int	_EXFUN(putenv,(char *__string));
 int	_EXFUN(_putenv_r,(struct _reent *, char *__string));
 _PTR	_EXFUN(_reallocf_r,(struct _reent *, _PTR, size_t));
@@ -189,18 +197,28 @@
        _EXFUN(_seed48_r,(struct _reent *, unsigned short [3]));
 _VOID  _EXFUN(srand48,(long));
 _VOID  _EXFUN(_srand48_r,(struct _reent *, long));
+#endif /* ! __STRICT_ANSI__ */
+#if !defined(__STRICT_ANSI__) || \
+  (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || \
+  (defined(__cplusplus) && __cplusplus >= 201103L)
 long long _EXFUN(atoll,(const char *__nptr));
+#endif
+#ifndef __STRICT_ANSI__
 long long _EXFUN(_atoll_r,(struct _reent *, const char *__nptr));
+#endif /* ! __STRICT_ANSI__ */
+#if !defined(__STRICT_ANSI__) || \
+  (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || \
+  (defined(__cplusplus) && __cplusplus >= 201103L)
 long long _EXFUN(llabs,(long long));
 lldiv_t	_EXFUN(lldiv,(long long __numer, long long __denom));
-#endif /* ! __STRICT_ANSI__ */
-#if !defined(__STRICT_ANSI__) || (__STDC_VERSION__ >= 199901L) || (__cplusplus >= 201103L)
 long long _EXFUN(strtoll,(const char *__restrict __n, char **__restrict __end_PTR, int __base));
 #endif
 #ifndef __STRICT_ANSI__
 long long _EXFUN(_strtoll_r,(struct _reent *, const char *__restrict __n, char **__restrict __end_PTR, int __base));
 #endif /* ! __STRICT_ANSI__ */
-#if !defined(__STRICT_ANSI__) || (__STDC_VERSION__ >= 199901L) || (__cplusplus >= 201103L)
+#if !defined(__STRICT_ANSI__) || \
+  (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || \
+  (defined(__cplusplus) && __cplusplus >= 201103L)
 unsigned long long _EXFUN(strtoull,(const char *__restrict __n, char **__restrict __end_PTR, int __base));
 #endif
 #ifndef __STRICT_ANSI__
@@ -232,7 +250,9 @@
 
 /* On platforms where long double equals double.  */
 #ifdef _HAVE_LONG_DOUBLE
-#if !defined(__STRICT_ANSI__) || (__STDC_VERSION__ >= 199901L) || (__cplusplus >= 201103L)
+#if !defined(__STRICT_ANSI__) || \
+  (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || \
+  (defined(__cplusplus) && __cplusplus >= 201103L)
 extern long double strtold (const char *__restrict, char **__restrict);
 #endif
 #endif /* _HAVE_LONG_DOUBLE */

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Support for long long type for C99 and C++11 compliant compilers
  2014-10-10 11:45         ` Thomas Uhle
@ 2014-10-10 14:44           ` Corinna Vinschen
  0 siblings, 0 replies; 7+ messages in thread
From: Corinna Vinschen @ 2014-10-10 14:44 UTC (permalink / raw)
  To: newlib

[-- Attachment #1: Type: text/plain, Size: 416 bytes --]

On Oct 10 13:45, Thomas Uhle wrote:
> 2014-10-10  Thomas Uhle <...>
> 
> 	* libc/include/_ansi.h: _LONG_LONG_TYPE definition removed.
> 	* libc/include/math.h: _LONG_LONG_TYPE replaced by "long long".
> 	Guards for C99 and C++11 functions fixed.
> 	* libc/include/stdlib.h: Guards for C99 and C++11 functions fixed.

Patch applied.


Thanks,
Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat

[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-10-10 14:44 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-09 18:06 Support for long long type for C99 and C++11 compliant compilers Thomas Uhle
2014-10-09 12:34 ` Corinna Vinschen
2014-10-09 14:20   ` Thomas Uhle
2014-10-09 16:53     ` Corinna Vinschen
2014-10-09 18:06       ` Jeff Johnston
2014-10-10 11:45         ` Thomas Uhle
2014-10-10 14:44           ` Corinna Vinschen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).