This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Decorate C prototypes
- From: Jan Hubicka <hubicka at ucw dot cz>
- To: libstdc++ at gcc dot gnu dot org, paolo dot carlini at oracle dot com
- Date: Wed, 22 Apr 2009 18:07:18 +0200
- Subject: Decorate C prototypes
Hi,
it turns out that there are several delcarations of C functions that
miss my warning (since they are not being compiled locally) but needs
decorations.
I verified the markers with what builtins.def and glibc does.
Tested on x86_64-linux, OK?
* include/c_std/cstdlib (abort, exit, _Exit): Mark noreturn throw ().
(atexit, atoll, stroll, strtoull): Mark throw ()
* include/c_std/cstdio (snprintf, vsnprintf, vscanf): Mark throw ().
* include/c_std/cwchar (wcstold, wcstoll, wcstoull): Mark throw ().
* include/c_global/cstdlib (abort, exit, _Exit): Mark noreturn throw ().
(atexit, atoll, stroll, strtoull): Mark throw ()
* include/c_global/cstdio (snprintf, vsnprintf, vscanf): Mark throw ().
* include/c_wchar/cstdio (snprintf, vsnprintf, vscanf): Mark throw ().
Index: include/c_std/cstdlib
===================================================================
--- include/c_std/cstdlib (revision 146576)
+++ include/c_std/cstdlib (working copy)
@@ -56,9 +56,9 @@
_GLIBCXX_BEGIN_NAMESPACE(std)
- extern "C" void abort(void);
- extern "C" int atexit(void (*)());
- extern "C" void exit(int);
+ extern "C" void abort(void) throw () _GLIBCXX_NORETURN;
+ extern "C" int atexit(void (*)()) throw ();
+ extern "C" void exit(int) throw () _GLIBCXX_NORETURN;
_GLIBCXX_END_NAMESPACE
@@ -159,7 +159,7 @@
using ::lldiv_t;
#endif
#if _GLIBCXX_USE_C99_CHECK || _GLIBCXX_USE_C99_DYNAMIC
- extern "C" void (_Exit)(int);
+ extern "C" void (_Exit)(int) throw () _GLIBCXX_NORETURN;
#endif
#if !_GLIBCXX_USE_C99_DYNAMIC
using ::_Exit;
@@ -179,11 +179,11 @@
#endif
#if _GLIBCXX_USE_C99_LONG_LONG_CHECK || _GLIBCXX_USE_C99_LONG_LONG_DYNAMIC
- extern "C" long long int (atoll)(const char *);
+ extern "C" long long int (atoll)(const char *) throw ();
extern "C" long long int
- (strtoll)(const char * restrict, char ** restrict, int);
+ (strtoll)(const char * restrict, char ** restrict, int) throw ();
extern "C" unsigned long long int
- (strtoull)(const char * restrict, char ** restrict, int);
+ (strtoull)(const char * restrict, char ** restrict, int) throw ();
#endif
#if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC
using ::atoll;
Index: include/c_std/cstdio
===================================================================
--- include/c_std/cstdio (revision 146576)
+++ include/c_std/cstdio (working copy)
@@ -151,14 +151,14 @@
#if _GLIBCXX_USE_C99_CHECK || _GLIBCXX_USE_C99_DYNAMIC
extern "C" int
- (snprintf)(char * restrict, size_t, const char * restrict, ...);
+ (snprintf)(char * restrict, size_t, const char * restrict, ...) throw ();
extern "C" int
(vfscanf)(FILE * restrict, const char * restrict, __gnuc_va_list);
extern "C" int (vscanf)(const char * restrict, __gnuc_va_list);
extern "C" int
- (vsnprintf)(char * restrict, size_t, const char * restrict, __gnuc_va_list);
+ (vsnprintf)(char * restrict, size_t, const char * restrict, __gnuc_va_list) throw ();
extern "C" int
- (vsscanf)(const char * restrict, const char * restrict, __gnuc_va_list);
+ (vsscanf)(const char * restrict, const char * restrict, __gnuc_va_list) throw ();
#endif
#if !_GLIBCXX_USE_C99_DYNAMIC
Index: include/c_std/cwchar
===================================================================
--- include/c_std/cwchar (revision 146576)
+++ include/c_std/cwchar (working copy)
@@ -239,16 +239,16 @@
#if _GLIBCXX_USE_C99_CHECK || _GLIBCXX_USE_C99_DYNAMIC
extern "C" long double
- (wcstold)(const wchar_t * restrict, wchar_t ** restrict);
+ (wcstold)(const wchar_t * restrict, wchar_t ** restrict) throw ();
#endif
#if !_GLIBCXX_USE_C99_DYNAMIC
using ::wcstold;
#endif
#if _GLIBCXX_USE_C99_LONG_LONG_CHECK || _GLIBCXX_USE_C99_LONG_LONG_DYNAMIC
extern "C" long long int
- (wcstoll)(const wchar_t * restrict, wchar_t ** restrict, int);
+ (wcstoll)(const wchar_t * restrict, wchar_t ** restrict, int) throw ();
extern "C" unsigned long long int
- (wcstoull)(const wchar_t * restrict, wchar_t ** restrict, int);
+ (wcstoull)(const wchar_t * restrict, wchar_t ** restrict, int) throw ();
#endif
#if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC
using ::wcstoll;
Index: include/c_global/cstdlib
===================================================================
--- include/c_global/cstdlib (revision 146576)
+++ include/c_global/cstdlib (working copy)
@@ -57,9 +57,9 @@
_GLIBCXX_BEGIN_NAMESPACE(std)
- extern "C" void abort(void);
- extern "C" int atexit(void (*)());
- extern "C" void exit(int);
+ extern "C" void abort(void) throw () _GLIBC_NORETURN;
+ extern "C" int atexit(void (*)()) throw ();
+ extern "C" void exit(int) throw () _GLIBC_NORETURN;
_GLIBCXX_END_NAMESPACE
@@ -160,7 +160,7 @@
using ::lldiv_t;
#endif
#if _GLIBCXX_USE_C99_CHECK || _GLIBCXX_USE_C99_DYNAMIC
- extern "C" void (_Exit)(int);
+ extern "C" void (_Exit)(int) throw () _GLIBCXX_NORETURN;
#endif
#if !_GLIBCXX_USE_C99_DYNAMIC
using ::_Exit;
@@ -180,11 +180,11 @@
#endif
#if _GLIBCXX_USE_C99_LONG_LONG_CHECK || _GLIBCXX_USE_C99_LONG_LONG_DYNAMIC
- extern "C" long long int (atoll)(const char *);
+ extern "C" long long int (atoll)(const char *) throw ();
extern "C" long long int
- (strtoll)(const char * restrict, char ** restrict, int);
+ (strtoll)(const char * restrict, char ** restrict, int) throw ();
extern "C" unsigned long long int
- (strtoull)(const char * restrict, char ** restrict, int);
+ (strtoull)(const char * restrict, char ** restrict, int) throw ();
#endif
#if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC
using ::atoll;
Index: include/c_global/cstdio
===================================================================
--- include/c_global/cstdio (revision 146576)
+++ include/c_global/cstdio (working copy)
@@ -151,14 +151,14 @@
#if _GLIBCXX_USE_C99_CHECK || _GLIBCXX_USE_C99_DYNAMIC
extern "C" int
- (snprintf)(char * restrict, size_t, const char * restrict, ...);
+ (snprintf)(char * restrict, size_t, const char * restrict, ...) throw ();
extern "C" int
(vfscanf)(FILE * restrict, const char * restrict, __gnuc_va_list);
extern "C" int (vscanf)(const char * restrict, __gnuc_va_list);
extern "C" int
- (vsnprintf)(char * restrict, size_t, const char * restrict, __gnuc_va_list);
+ (vsnprintf)(char * restrict, size_t, const char * restrict, __gnuc_va_list) throw ();
extern "C" int
- (vsscanf)(const char * restrict, const char * restrict, __gnuc_va_list);
+ (vsscanf)(const char * restrict, const char * restrict, __gnuc_va_list) throw ();
#endif
#if !_GLIBCXX_USE_C99_DYNAMIC
Index: include/c_global/cwchar
===================================================================
--- include/c_global/cwchar (revision 146576)
+++ include/c_global/cwchar (working copy)
@@ -239,16 +239,16 @@
#if _GLIBCXX_USE_C99_CHECK || _GLIBCXX_USE_C99_DYNAMIC
extern "C" long double
- (wcstold)(const wchar_t * restrict, wchar_t ** restrict);
+ (wcstold)(const wchar_t * restrict, wchar_t ** restrict) throw ();
#endif
#if !_GLIBCXX_USE_C99_DYNAMIC
using ::wcstold;
#endif
#if _GLIBCXX_USE_C99_LONG_LONG_CHECK || _GLIBCXX_USE_C99_LONG_LONG_DYNAMIC
extern "C" long long int
- (wcstoll)(const wchar_t * restrict, wchar_t ** restrict, int);
+ (wcstoll)(const wchar_t * restrict, wchar_t ** restrict, int) throw ();
extern "C" unsigned long long int
- (wcstoull)(const wchar_t * restrict, wchar_t ** restrict, int);
+ (wcstoull)(const wchar_t * restrict, wchar_t ** restrict, int) throw ();
#endif
#if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC
using ::wcstoll;