diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 3a74f940ae9..3c50834a923 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,59 @@ +2000-10-30 Benjamin Kosnik + + * src/complex_io.cc : Remove ancient defines. + * config/os/gnu-linux/bits/os_defines.h: Add defines. + * libsupc++/tinfo2.cc: Change to cstddef. + + * include/bits/codecvt.h: Add include of c++config.h, so that + __USE_GNU gets defined. (Important for alpha.) + + * include/c/bits/std_cwctype.h: Same. + * include/c/bits/std_ctime.h: And here. + * include/c/bits/std_cstdarg.h: Same. + * include/c/bits/std_csignal.h: Same. + * include/c/bits/std_csetjmp.h: Same. + * include/c/bits/std_clocale.h: Same. + * include/c/bits/std_climits.h: Touch. + * include/c/bits/std_cfloat.h: Same. + * include/c/bits/std_cerrno.h: Same. + * include/c/bits/std_cwchar.h: Same. + * include/c/bits/std_cassert.h: Same. + * include/c/bits/std_cctype.h: Same. + * include/c/bits/std_cstddef.h: And here. + * include/c/bits/std_cstdlib.h: And here. + * include/c/bits/std_cstdio.h: Same. + * include/c/bits/std_cstring.h: Add names to namespace std::. + + * include/bits/c++config (_GNU_SOURCE): Move linux-specific macros + from here... + (_ISOC99_SOURCE): And this one.... + * config/os/gnu-linux/bits/os_defines.h: ...to here. + + * include/bits/codecvt.h (codecvt<_InternT, _ExternT, + __enc_traits>::do_in): Don't cast to const, this is a bug in glibc + prior to 2.2. + (codecvt<_InternT, _ExternT, __enc_traits>::do_out): Same. + * include/c/bits/std_cwchar.h: Add using declarations for mbstate_t. + +2000-10-30 Steven King + + * include/bits/codecvt.h: Add cast. + * include/c_std/stdio.h: Re-add printf using declaration. + * include/c_std/bits/std_cstdio.h: Same + * testsuite/22_locale/codecvt_wchar_t_char.cc: Fixup testsuite. + * testsuite/22_locale/ctor_copy_dtor.cc: Same. + * testsuite/22_locale/facet.cc: Same. + * testsuite/22_locale/global_templates.cc: Same. + * testsuite/22_locale/operators.cc: Same. + * testsuite/22_locale/static_members.cc: Same. + * testsuite/26_numerics/c_math.cc: Same. + * testsuite/26_numerics/complex_inserters_extractors.cc: Same. + * testsuite/27_io/fpos.cc: Same. + * testsuite/27_io/istream_extractor_arith.cc: Same. + * testsuite/27_io/istream_unformatted.cc: Same. + * testsuite/27_io/ostream_inserter_arith.cc: Same. + * testsuite/27_io/streambuf.cc: Same. + 2000-10-30 Mark Mitchell * acinclude.m4 (GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT): Check diff --git a/libstdc++-v3/config/os/gnu-linux/bits/os_defines.h b/libstdc++-v3/config/os/gnu-linux/bits/os_defines.h index 6147f0b67f9..a98b34892e5 100644 --- a/libstdc++-v3/config/os/gnu-linux/bits/os_defines.h +++ b/libstdc++-v3/config/os/gnu-linux/bits/os_defines.h @@ -31,11 +31,22 @@ #ifndef _GLIBCPP_OS_DEFINES # define _GLIBCPP_OS_DEFINES +// By enabling this, all GNU extensions are enabled. +#define _GNU_SOURCE 1 -/* System-specific #define, typedefs, corrections, etc, go here. This - file will come before all others. */ +// By enabling this, all ISO C99, ISO C9X functionality is enabled. +#define _ISOC99_SOURCE 1 +// This keeps isanum, et al from being propagated as macros. +#define __NO_CTYPE 1 + +# if defined __GLIBC__ && __GLIBC__ >= 2 +// We must not see the optimized string functions GNU libc defines. +# define __NO_STRING_INLINES +# endif #endif + + diff --git a/libstdc++-v3/include/bits/c++config b/libstdc++-v3/include/bits/c++config index 860cc5674c4..57f0e4db9af 100644 --- a/libstdc++-v3/include/bits/c++config +++ b/libstdc++-v3/include/bits/c++config @@ -36,12 +36,6 @@ // The current version of the C++ library in compressed ISO date format. #define __GLIBCPP__ 20000911 -// By enabling this, all GNU extensions are enabled. -#define _GNU_SOURCE 1 - -// By enabling this, all ISO C99, ISO C9X functionality is enabled. -#define _ISOC99_SOURCE 1 - // This flag controls the error handling in string, and perhaps other // bits as time goes on: check out bits/basic_string.h for more // info. It also helps alleviate the circular dependency between diff --git a/libstdc++-v3/include/bits/codecvt.h b/libstdc++-v3/include/bits/codecvt.h index 738d5af3678..f39009a9ea5 100644 --- a/libstdc++-v3/include/bits/codecvt.h +++ b/libstdc++-v3/include/bits/codecvt.h @@ -38,6 +38,7 @@ #ifndef _CPP_BITS_CODECVT_H #define _CPP_BITS_CODECVT_H 1 +#include #ifdef _GLIBCPP_USE_WCHAR_T #include // For iconv, iconv_t #include diff --git a/libstdc++-v3/include/c/bits/std_cassert.h b/libstdc++-v3/include/c/bits/std_cassert.h index 5d9d18445f9..0cd937e4039 100644 --- a/libstdc++-v3/include/c/bits/std_cassert.h +++ b/libstdc++-v3/include/c/bits/std_cassert.h @@ -1,6 +1,6 @@ // -*- C++ -*- forwarding header. -// Copyright (C) 1997-1999 Free Software Foundation, Inc. +// Copyright (C) 1997-1999, 2000 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -35,5 +35,15 @@ // No include guards on this header... -# pragma GCC system_header -# include_next +#pragma GCC system_header +#include_next + + + + + + + + + + diff --git a/libstdc++-v3/include/c/bits/std_cctype.h b/libstdc++-v3/include/c/bits/std_cctype.h index 1c1e69c6c5d..bb50610b815 100644 --- a/libstdc++-v3/include/c/bits/std_cctype.h +++ b/libstdc++-v3/include/c/bits/std_cctype.h @@ -31,172 +31,35 @@ // ISO C++ 14882: // +// Note: This is not a conforming implementation. + #ifndef _CPP_CCTYPE #define _CPP_CCTYPE 1 -// This keeps isanum, et al from being propagated as macros. -#if __linux__ -#define __NO_CTYPE 1 -#endif +#include -# pragma GCC system_header -# include_next +#pragma GCC system_header +#include_next -// Sequester the C non-inline implementations in the _C_Swamp:: -// namespace, and provide C++ inlines for them in the std:: namespace -// where they belong. - -namespace std +namespace std { - // NB: If not using namespaces, can't have any of these definitions, - // as they will duplicate what's in the global namespace. + extern "C" int isalnum(int __c); + extern "C" int isalpha(int __c); + extern "C" int isblank(int __c); + extern "C" int iscntrl(int __c); + extern "C" int isdigit(int __c); + extern "C" int isgraph(int __c); + extern "C" int islower(int __c); + extern "C" int isprint(int __c); + extern "C" int ispunct(int __c); + extern "C" int isspace(int __c); + extern "C" int isupper(int __c); + extern "C" int isxdigit(int __c); + extern "C" int tolower(int __c); + extern "C" int toupper(int __c); +} -#ifdef toupper - inline int - _S_toupper_helper(int __c) { return toupper(__c); } -# undef toupper - inline int - toupper(int __c) { return _S_toupper_helper(__c); } -#else - inline int - toupper(int __c) { return ::toupper(__c); } -#endif - -#ifdef tolower - inline int - _S_tolower_helper(int __c) { return tolower(__c); } -# undef tolower - inline int - tolower(int __c) { return _S_tolower_helper(__c); } -#else - inline int - tolower(int __c) { return ::tolower(__c); } -#endif - -#ifdef isspace - inline int - _S_isspace_helper(int __c) { return isspace(__c); } -# undef isspace - inline int - isspace(int __c) { return _S_isspace_helper(__c); } -#else - inline int - isspace(int __c) { return ::isspace(__c); } -#endif - -#ifdef isprint - inline int - _S_isprint_helper(int __c) { return isprint(__c); } -# undef isprint - inline int - isprint(int __c) { return _S_isprint_helper(__c); } -#else - inline int - isprint(int __c) { return ::isprint(__c); } -#endif - -#ifdef iscntrl - inline int - _S_iscntrl_helper(int __c) { return iscntrl(__c); } -# undef iscntrl - inline int - iscntrl(int __c) { return _S_iscntrl_helper(__c); } -#else - inline int - iscntrl(int __c) { return ::iscntrl(__c); } -#endif - -#ifdef isupper - inline int - _S_isupper_helper(int __c) { return isupper(__c); } -# undef isupper - inline int - isupper(int __c) { return _S_isupper_helper(__c); } -#else - inline int - isupper(int __c) { return ::isupper(__c); } -#endif - -#ifdef islower - inline int - _S_islower_helper(int __c) { return islower(__c); } -# undef islower - inline int - islower(int __c) { return _S_islower_helper(__c); } -#else - inline int - islower(int __c) { return ::islower(__c); } -#endif - -#ifdef isalpha - inline int - _S_isalpha_helper(int __c) { return isalpha(__c); } -# undef isalpha - inline int - isalpha(int __c) { return _S_isalpha_helper(__c); } -#else - inline int - isalpha(int __c) { return ::isalpha(__c); } -#endif - -#ifdef isdigit - inline int - _S_isdigit_helper(int __c) { return isdigit(__c); } -# undef isdigit - inline int - isdigit(int __c) { return _S_isdigit_helper(__c); } -#else - inline int - isdigit(int __c) { return ::isdigit(__c); } -#endif - -#ifdef ispunct - inline int - _S_ispunct_helper(int __c) { return ispunct(__c); } -# undef ispunct - inline int - ispunct(int __c) { return _S_ispunct_helper(__c); } -#else - inline int - ispunct(int __c) { return ::ispunct(__c); } -#endif - -#ifdef isxdigit - inline int - _S_isxdigit_helper(int __c) { return isxdigit(__c); } -# undef isxdigit - inline int - isxdigit(int __c) { return _S_isxdigit_helper(__c); } -#else - inline int - isxdigit(int __c) { return ::isxdigit(__c); } -#endif - -#ifdef isalnum - inline int - _S_isalnum_helper(int __c) { return isalnum(__c); } -# undef isalnum - inline int - isalnum(int __c) { return _S_isalnum_helper(__c); } -#else - inline int - isalnum(int __c) { return ::isalnum(__c); } -#endif - -#ifdef isgraph - inline int - _S_isgraph_helper(int __c) { return isgraph(__c); } -# undef isgraph - inline int - isgraph(int __c) { return _S_isgraph_helper(__c); } -#else - inline int - isgraph(int __c) { return ::isgraph(__c); } -#endif - -} // namespace std - -#endif // _CPP_CCTYPE +#endif diff --git a/libstdc++-v3/include/c/bits/std_cerrno.h b/libstdc++-v3/include/c/bits/std_cerrno.h index abd28d560d8..518651008ba 100644 --- a/libstdc++-v3/include/c/bits/std_cerrno.h +++ b/libstdc++-v3/include/c/bits/std_cerrno.h @@ -31,10 +31,21 @@ // ISO C++ 14882: 19.3 Error numbers // -// Note: this is not a conforming implementation. +// Note: This is not a conforming implementation. #ifndef _CPP_CERRNO #define _CPP_CERRNO 1 -# pragma GCC system_header -# include_next + +#pragma GCC system_header +#include_next + +namespace std +{ + extern "C" int errno; +} + #endif + + + + diff --git a/libstdc++-v3/include/c/bits/std_cfloat.h b/libstdc++-v3/include/c/bits/std_cfloat.h index 8a317fcb490..4ff42b0865c 100644 --- a/libstdc++-v3/include/c/bits/std_cfloat.h +++ b/libstdc++-v3/include/c/bits/std_cfloat.h @@ -1,6 +1,6 @@ // -*- C++ -*- forwarding header. -// Copyright (C) 1997-1999 Free Software Foundation, Inc. +// Copyright (C) 1997-1999, 2000 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -31,17 +31,13 @@ // ISO C++ 14882: 18.2.2 Implementation properties: C library // -// Note: this is not a conforming implementation. +// Note: This is not a conforming implementation. #ifndef _CPP_CFLOAT #define _CPP_CFLOAT 1 -# pragma GCC system_header -# include_next -#if 0 -# ifdef __GLIBC__ -// For GNU libc we must also include this one: -# include -# endif -#endif +#pragma GCC system_header +#include_next + #endif + diff --git a/libstdc++-v3/include/c/bits/std_climits.h b/libstdc++-v3/include/c/bits/std_climits.h index ddd6bd8b40f..d7b171df041 100644 --- a/libstdc++-v3/include/c/bits/std_climits.h +++ b/libstdc++-v3/include/c/bits/std_climits.h @@ -35,8 +35,13 @@ #ifndef _CPP_CLIMITS #define _CPP_CLIMITS 1 -# pragma GCC system_header -# include_next + +#pragma GCC system_header +#include_next + #endif + + + diff --git a/libstdc++-v3/include/c/bits/std_clocale.h b/libstdc++-v3/include/c/bits/std_clocale.h index a8a44b8571a..0ce02976fe4 100644 --- a/libstdc++-v3/include/c/bits/std_clocale.h +++ b/libstdc++-v3/include/c/bits/std_clocale.h @@ -1,6 +1,6 @@ // -*- C++ -*- forwarding header. -// Copyright (C) 1997-1999 Free Software Foundation, Inc. +// Copyright (C) 1997-1999, 2000 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -31,11 +31,22 @@ // ISO C++ 14882: 18.2.2 Implementation properties: C library // -// Note: this is not a conforming implementation. +// Note: This is not a conforming implementation. #ifndef _CPP_CLOCALE -#define _CPP_CLOCALE 1 -# pragma GCC system_header -# include_next +#define _CPP_CLOCALE 1 + +#pragma GCC system_header +#include_next + +namespace std +{ + using ::lconv; + extern "C" char* setlocale(int, const char*); + extern "C" struct lconv* localeconv(void); +} + #endif + + diff --git a/libstdc++-v3/include/c/bits/std_cmath.h b/libstdc++-v3/include/c/bits/std_cmath.h index fe09b224b94..5a2c5056737 100644 --- a/libstdc++-v3/include/c/bits/std_cmath.h +++ b/libstdc++-v3/include/c/bits/std_cmath.h @@ -31,23 +31,24 @@ // ISO C++ 14882: 26.5 C library // -// Note: this is not a conforming implementation. +// Note: This is not a conforming implementation. #ifndef _CPP_CMATH #define _CPP_CMATH 1 -# pragma GCC system_header -# include_next -# include_next -# include - -namespace std { - - inline int - abs(int i) { return i > 0 ? i : -i; } +#include +#include + +#pragma GCC system_header +#include_next +namespace std +{ inline long - abs(long i) { return i > 0 ? i : -i; } + abs(long __i) { return ::labs(__i); } + + inline ldiv_t + div(long __i, long __j) { return ::ldiv(__i, __j); } #if _GLIBCPP_HAVE___BUILTIN_FABSF inline float @@ -212,7 +213,8 @@ namespace std { { return ::pow(static_cast(__x), static_cast(__y)); } #endif - float pow(float, int); + float + pow(float, int); #if _GLIBCPP_HAVE___BUILTIN_SINF inline float @@ -310,12 +312,10 @@ namespace std { extern "C" double modf(double __x, double* __iptr); -#if 0 extern "C" double pow(double __x, double __y); - extern "C" double pow(double, int); -#endif - using ::pow; + double + pow(double __x, int __i); #if _GLIBCPP_HAVE___BUILTIN_SIN inline double @@ -552,7 +552,10 @@ namespace std { #endif } // std -#endif // _CPP_CMATH +#endif + + + diff --git a/libstdc++-v3/include/c/bits/std_csetjmp.h b/libstdc++-v3/include/c/bits/std_csetjmp.h index fc5b339036a..a7864b0fc1f 100644 --- a/libstdc++-v3/include/c/bits/std_csetjmp.h +++ b/libstdc++-v3/include/c/bits/std_csetjmp.h @@ -1,6 +1,6 @@ // -*- C++ -*- forwarding header. -// Copyright (C) 1997-1999 Free Software Foundation, Inc. +// Copyright (C) 1997-1999, 2000 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -31,10 +31,18 @@ // ISO C++ 14882: 20.4.6 C library // -// Note: this is not a conforming implementation. +// Note: This is not a conforming implementation. #ifndef _CPP_CSETJMP #define _CPP_CSETJMP 1 -# pragma GCC system_header -# include_next + +#pragma GCC system_header +#include_next + +namespace std +{ + using ::jmp_buf; + extern "C" void longjmp(jmp_buf, int); +} + #endif diff --git a/libstdc++-v3/include/c/bits/std_csignal.h b/libstdc++-v3/include/c/bits/std_csignal.h index 34c03eb3df1..48f6584b25d 100644 --- a/libstdc++-v3/include/c/bits/std_csignal.h +++ b/libstdc++-v3/include/c/bits/std_csignal.h @@ -1,6 +1,6 @@ // -*- C++ -*- forwarding header. -// Copyright (C) 1997-1999 Free Software Foundation, Inc. +// Copyright (C) 1997-1999, 2000 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -31,10 +31,19 @@ // ISO C++ 14882: 20.4.6 C library // -// Note: this is not a conforming implementation. +// Note: This is not a conforming implementation. #ifndef _CPP_CSIGNAL #define _CPP_CSIGNAL 1 -# pragma GCC system_header -# include_next + +#pragma GCC system_header +#include_next + +namespace std +{ + using ::sig_atomic_t; + extern "C" void (*signal(int, void (*__func)(int)))(int); + extern "C" int raise(int); +} + #endif diff --git a/libstdc++-v3/include/c/bits/std_cstdarg.h b/libstdc++-v3/include/c/bits/std_cstdarg.h index f7f4235a290..87a8a0f54b7 100644 --- a/libstdc++-v3/include/c/bits/std_cstdarg.h +++ b/libstdc++-v3/include/c/bits/std_cstdarg.h @@ -1,6 +1,6 @@ // -*- C++ -*- forwarding header. -// Copyright (C) 1997-1999 Free Software Foundation, Inc. +// Copyright (C) 1997-1999, 2000 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -31,10 +31,17 @@ // ISO C++ 14882: 20.4.6 C library // -// Note: this is not a conforming implementation. +// Note: This is not a conforming implementation. #ifndef _CPP_CSTDARG #define _CPP_CSTDARG 1 -# pragma GCC system_header -# include_next + +#pragma GCC system_header +#include_next + +namespace std +{ + using ::va_list; +} + #endif diff --git a/libstdc++-v3/include/c/bits/std_cstddef.h b/libstdc++-v3/include/c/bits/std_cstddef.h index ea517e41a4d..a256e854833 100644 --- a/libstdc++-v3/include/c/bits/std_cstddef.h +++ b/libstdc++-v3/include/c/bits/std_cstddef.h @@ -1,6 +1,6 @@ // -*- C++ -*- forwarding header. -// Copyright (C) 1997-1999 Free Software Foundation, Inc. +// Copyright (C) 1997-1999, 2000 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -31,17 +31,18 @@ // ISO C++ 14882: 18.1 Types // -// Note: this is not a conforming implementation. +// Note: This is not a conforming implementation. #ifndef _CPP_CSTDDEF #define _CPP_CSTDDEF 1 -# pragma GCC system_header -# include_next -#endif -namespace std { - using ::size_t; +#pragma GCC system_header +#include_next + +namespace std +{ using ::ptrdiff_t; -} // namespace std - + using ::size_t; +} +#endif diff --git a/libstdc++-v3/include/c/bits/std_cstdio.h b/libstdc++-v3/include/c/bits/std_cstdio.h index 919a03ca4c7..b5836244f2a 100644 --- a/libstdc++-v3/include/c/bits/std_cstdio.h +++ b/libstdc++-v3/include/c/bits/std_cstdio.h @@ -1,6 +1,6 @@ // -*- C++ -*- forwarding header. -// Copyright (C) 1997-1999 Free Software Foundation, Inc. +// Copyright (C) 1997-1999, 2000 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -31,24 +31,68 @@ // ISO C++ 14882: 27.8.2 C Library files // -// Note: this is not a conforming implementation. +// Note: This is not a conforming implementation. #ifndef _CPP_CSTDIO #define _CPP_CSTDIO 1 -# pragma GCC system_header -# include_next -#ifndef SEEK_CUR -#define SEEK_CUR 1 -#endif +#include -#ifndef SEEK_END -#define SEEK_END 2 -#endif +#pragma GCC system_header +#include_next -#ifndef SEEK_SET -#define SEEK_SET 4 -#endif +namespace std +{ + using ::FILE; + using ::fpos_t; + + extern "C" int remove(const char*); + extern "C" int rename(const char*, const char*); + extern "C" FILE* tmpfile(void); + extern "C" char* tmpnam(char*); + extern "C" int fclose(FILE*); + extern "C" int fflush(FILE*); + extern "C" FILE* fopen(const char*, const char*); + extern "C" FILE* freopen(const char*, const char*, FILE*); + extern "C" void setbuf(FILE*, char*); + extern "C" int setvbuf(FILE*, char*, int, size_t); + extern "C" int fprintf(FILE*, const char*, ...); + extern "C" int fscanf(FILE*, const char*, ...); + extern "C" int printf(const char*, ...); + extern "C" int scanf(const char*, ...); + extern "C" int snprintf(char *, size_t, const char*, ...); + extern "C" int sprintf(char *, const char*, ...); + extern "C" int sscanf(const char*, const char*, ...); + extern "C" int vfprintf(FILE*, const char*, va_list); + extern "C" int vfscanf(FILE*, const char*, va_list); + extern "C" int vprintf(const char*, va_list); + extern "C" int vscanf(const char*, va_list); + extern "C" int vsnprintf(char*, size_t, const char*, va_list); + extern "C" int vsprintf(char*, const char*, va_list); + extern "C" int vsscanf(const char*, const char*, va_list); + extern "C" int fgetc(FILE *); + extern "C" char *fgets(char*, int, FILE*); + extern "C" int fputc(int, FILE*); + extern "C" int fputs(const char*, FILE*); + extern "C" int getc(FILE*); + extern "C" int getchar(void); + extern "C" char *gets(char*); + extern "C" int putc(int, FILE*); + extern "C" int putchar(int); + extern "C" int puts(const char*); + extern "C" int ungetc(int, FILE*); + extern "C" size_t fread(void*, size_t, size_t, FILE*); + extern "C" size_t fwrite(const void*, size_t, size_t, FILE*); + extern "C" int fgetpos(FILE*, fpos_t*); + extern "C" int fseek(FILE*, long int, int); + extern "C" int fsetpos(FILE*, const fpos_t*); + extern "C" long int ftell(FILE*); + extern "C" void rewind(FILE*); + extern "C" void clearerr(FILE*); + extern "C" int feof(FILE*); + extern "C" int ferror(FILE*); + extern "C" void perror(const char*); +} #endif diff --git a/libstdc++-v3/include/c/bits/std_cstdlib.h b/libstdc++-v3/include/c/bits/std_cstdlib.h index ee5435739ad..10600e60f30 100644 --- a/libstdc++-v3/include/c/bits/std_cstdlib.h +++ b/libstdc++-v3/include/c/bits/std_cstdlib.h @@ -1,6 +1,6 @@ // -*- C++ -*- forwarding header. -// Copyright (C) 1997-1999 Free Software Foundation, Inc. +// Copyright (C) 1997-1999, 2000 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -31,20 +31,92 @@ // ISO C++ 14882: 20.4.6 C library // -// Note: this is not a conforming implementation. +// Note: This is not a conforming implementation. #ifndef _CPP_CSTDLIB #define _CPP_CSTDLIB 1 -// This keeps isanum, et al from being propagated as macros. -#if __linux__ -#define __USE_ISOC9X 1 +#include + +#pragma GCC system_header +#include_next + +namespace std +{ + using ::div_t; + using ::ldiv_t; + +#ifdef _GLIBCPP_USE_LONG_LONG +# ifdef _GLIBCPP_HAVE_LLDIV_T + using ::lldiv_t; +# else + struct lldiv_t + { + long long quot; + long long rem; + }; +# endif +#endif + + extern "C" double atof(const char*); + extern "C" int atoi(const char*); + extern "C" long int atol(const char*); + extern "C" double strtod(const char*, char**); + extern "C" float strtof(const char*, char**); + extern "C" long int strtol(const char*, char**, int); + extern "C" unsigned long int strtoul(const char*, char**, int); + extern "C" int rand(void); + extern "C" void srand(unsigned int); + extern "C" void* calloc(size_t, size_t); + extern "C" void free(void*); + extern "C" void* malloc(size_t); + extern "C" void* realloc(void*, size_t); + extern "C" void abort(void); + extern "C" int atexit(void (*func)(void)); + extern "C" void exit(int); + extern "C" void _Exit(int); + extern "C" char*getenv(const char*); + extern "C" int system(const char*); + extern "C" void* bsearch(const void*, const void*, size_t, size_t, + int (*comp)(const void *, const void *)); + extern "C" void qsort(void*, size_t, size_t, + int (*comp)(const void *, const void *)); + extern "C" int abs(int); + extern "C" long int labs(long int); + extern "C" div_t div(int, int); + extern "C" ldiv_t ldiv(long int, long int); + extern "C" int mblen(const char*, size_t); + extern "C" int mbtowc(wchar_t*, const char*, size_t); + extern "C" int wctomb(char*, wchar_t); + extern "C" size_t mbstowcs(wchar_t*, const char*, size_t); + extern "C" size_t wcstombs(char*, const wchar_t*, size_t); + +#ifdef _GLIBCPP_USE_LONG_LONG + inline long long + abs(long long __x) { return __x >= 0 ? __x : -__x; } + + inline long long + llabs(long long __x) { return __x >= 0 ? __x : -__x; } + + inline lldiv_t + div(long long __n, long long __d) + { lldiv_t __q; __q.quot = __n / __d; __q.rem = __n % __d; return __q; } + + inline lldiv_t + lldiv(long long __n, long long __d) + { lldiv_t __q; __q.quot = __n / __d; __q.rem = __n % __d; return __q; } + + extern "C" long long int atoll(const char*); + extern "C" long long int strtoll(const char*, char**, int); + extern "C" unsigned long long int strtoull(const char*, char**, int); #endif -# pragma GCC system_header -# include_next +#ifdef _GLIBCPP_HAVE_STRTOLD + extern "C" long double strtold(const char*, char**); +#endif +} -#endif // _CPP_CSTDLIB +#endif diff --git a/libstdc++-v3/include/c/bits/std_cstring.h b/libstdc++-v3/include/c/bits/std_cstring.h index 06bcdda6535..252693b40d4 100644 --- a/libstdc++-v3/include/c/bits/std_cstring.h +++ b/libstdc++-v3/include/c/bits/std_cstring.h @@ -1,6 +1,6 @@ // -*- C++ -*- forwarding header. -// Copyright (C) 1997-1999 Free Software Foundation, Inc. +// Copyright (C) 1997-1999, 2000 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -31,14 +31,43 @@ // ISO C++ 14882: 20.4.6 C library // -// Note: this is not a conforming implementation. +// Note: This is not a conforming implementation. #ifndef _CPP_CSTRING #define _CPP_CSTRING 1 -# if defined __GLIBC__ && __GLIBC__ >= 2 -// We must not see the optimized string functions GNU libc defines. -# define __NO_STRING_INLINES -# endif -# pragma GCC system_header -# include_next + +#include + +#pragma GCC system_header +#include_next + +namespace std +{ + extern "C" void* memcpy(void*, const void*, size_t); + extern "C" void* memmove(void*, const void*, size_t); + extern "C" char* strcpy(char*, const char*); + extern "C" char* strncpy(char*, const char*, size_t); + extern "C" char* strcat(char*, const char*); + extern "C" char* strncat(char*, const char*, size_t); + extern "C" int memcmp(const void*, const void*, size_t); + extern "C" int strcmp(const char*, const char*); + extern "C" int strcoll(const char*, const char*); + extern "C" int strncmp(const char*, const char*, size_t); + extern "C" size_t strxfrm(char*, const char*, size_t); + extern "C" void* memchr(const void*, int, size_t); + extern "C" char* strchr(const char*, int); + extern "C" size_t strcspn(const char*, const char*); + extern "C" char* strpbrk(const char*, const char*); + extern "C" char* strrchr(const char*, int); + extern "C" size_t strspn(const char*, const char*); + extern "C" char* strstr(const char*, const char*); + extern "C" char* strtok(char*, const char*); + extern "C" void* memset(void*, int, size_t); + extern "C" char* strerror(int); + extern "C" size_t strlen(const char*); +} + #endif + + + diff --git a/libstdc++-v3/include/c/bits/std_ctime.h b/libstdc++-v3/include/c/bits/std_ctime.h index b30b318f595..8c700e699f2 100644 --- a/libstdc++-v3/include/c/bits/std_ctime.h +++ b/libstdc++-v3/include/c/bits/std_ctime.h @@ -1,6 +1,6 @@ // -*- C++ -*- forwarding header. -// Copyright (C) 1997-1999 Free Software Foundation, Inc. +// Copyright (C) 1997-1999, 2000 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -31,10 +31,29 @@ // ISO C++ 14882: 20.5 Date and time // -// Note: this is not a conforming implementation. +// Note: This is not a conforming implementation. #ifndef _CPP_CTIME #define _CPP_CTIME 1 -# pragma GCC system_header -# include_next + +#pragma GCC system_header +#include_next + +namespace std +{ + using ::clock_t; + using ::time_t; + using ::tm; + + extern "C" clock_t clock(void); + extern "C" double difftime(time_t, time_t); + extern "C" time_t mktime(struct tm*); + extern "C" time_t time(time_t*); + extern "C" char* asctime(const struct tm*); + extern "C" char* ctime(const time_t*); + extern "C" struct tm* gmtime(const time_t*); + extern "C" struct tm* localtime(const time_t*); + extern "C" size_t strftime(char*, size_t, const char*, const struct tm*); +} + #endif diff --git a/libstdc++-v3/include/c/bits/std_cwchar.h b/libstdc++-v3/include/c/bits/std_cwchar.h index 77349f9d318..cc769402c53 100644 --- a/libstdc++-v3/include/c/bits/std_cwchar.h +++ b/libstdc++-v3/include/c/bits/std_cwchar.h @@ -31,31 +31,107 @@ // ISO C++ 14882: ??? // -// Note: this is not a conforming implementation. +// Note: This is not a conforming implementation. #ifndef _CPP_CWCHAR #define _CPP_CWCHAR 1 #include +#include +#include #if _GLIBCPP_USE_WCHAR_T - # pragma GCC system_header - # include_next +#pragma GCC system_header +#include_next + +namespace std +{ + using ::wint_t; + using ::mbstate_t; + + extern "C" wint_t btowc(int); + extern "C" int wctob(wint_t); + extern "C" wint_t fgetwc(FILE*); + extern "C" wchar_t* fgetws(wchar_t*, int, FILE*); + extern "C" wint_t fputwc(wchar_t, FILE*); + extern "C" int fputws(const wchar_t*, FILE*); + extern "C" int fwide(FILE*, int); + extern "C" int fwprintf(FILE*, const wchar_t*, ...); + extern "C" int fwscanf(FILE*, const wchar_t*, ...); + extern "C" int swprintf(wchar_t*, size_t, const wchar_t*, ...); + extern "C" int swscanf(const wchar_t*, const wchar_t*, ...); + extern "C" int vfwprintf(FILE*, const wchar_t*, va_list); + extern "C" int vfwscanf(FILE*, const wchar_t*, va_list); + extern "C" int vswprintf(wchar_t*, size_t, const wchar_t*, va_list); + extern "C" int vswscanf(const wchar_t*, const wchar_t*, va_list); + extern "C" int vwprintf(const wchar_t*, va_list); + extern "C" int vwscanf(const wchar_t*, va_list); + extern "C" int wprintf(const wchar_t*, ...); + extern "C" int wscanf(const wchar_t*, ...); + extern "C" wint_t getwc(FILE* stream); + extern "C" wint_t getwchar(void); + extern "C" int mbsinit(const mbstate_t*); + extern "C" size_t mbrlen(const char*, size_t, mbstate_t*); + extern "C" size_t mbrtowc(wchar_t*, const char*, size_t, mbstate_t*); + extern "C" size_t mbsrtowcs(wchar_t*, const char**, size_t, mbstate_t*); + extern "C" size_t wcsrtombs(char*, const wchar_t **, size_t, mbstate_t*); + extern "C" wint_t putwc(wchar_t, FILE*); + extern "C" wint_t putwchar(wchar_t); + extern "C" wint_t ungetwc(wint_t, FILE*); + extern "C" size_t wcrtomb(char*, wchar_t, mbstate_t*); + extern "C" double wcstod(const wchar_t*, wchar_t**); + extern "C" float wcstof(const wchar_t*, wchar_t**); + extern "C" long int wcstol(const wchar_t*, wchar_t**, int); + extern "C" unsigned long int wcstoul(const wchar_t*, wchar_t**, int); + extern "C" wchar_t* wcscpy(wchar_t* s1, const wchar_t*); + extern "C" wchar_t* wcsncpy(wchar_t*, const wchar_t*, size_t); + extern "C" wchar_t* wcscat(wchar_t*, const wchar_t*); + extern "C" wchar_t* wcsncat(wchar_t*, const wchar_t*, size_t); + extern "C" int wcscmp(const wchar_t*, const wchar_t*); + extern "C" int wcscoll(const wchar_t*, const wchar_t*); + extern "C" int wcsncmp(const wchar_t*, const wchar_t*, size_t); + extern "C" size_t wcsxfrm(wchar_t*, const wchar_t*, size_t); + extern "C" wchar_t* wcschr(const wchar_t*, wchar_t); + extern "C" size_t wcscspn(const wchar_t*, const wchar_t*); + extern "C" size_t wcslen(const wchar_t*); + extern "C" wchar_t* wcspbrk(const wchar_t*, const wchar_t*); + extern "C" wchar_t* wcsrchr(const wchar_t*, wchar_t); + extern "C" size_t wcsspn(const wchar_t*, const wchar_t*); + extern "C" wchar_t* wcsstr(const wchar_t*, const wchar_t*); + extern "C" wchar_t* wcstok(wchar_t*, const wchar_t*, wchar_t**); + extern "C" wchar_t* wmemchr(const wchar_t*, wchar_t, size_t); + extern "C" int wmemcmp(const wchar_t*, const wchar_t*, size_t); + //extern "C" int wmemcmp(wchar_t*, const wchar_t*, size_t); + extern "C" wchar_t* wmemcpy(wchar_t*, const wchar_t*, size_t); + extern "C" wchar_t* wmemmove(wchar_t*, const wchar_t*, size_t); + extern "C" wchar_t* wmemset(wchar_t*, wchar_t, size_t); + extern "C" size_t wcsftime(wchar_t*, size_t, const wchar_t*, const struct tm*); + +#if 0 + // Full C9X listing + extern "C" long double wcstold(const wchar_t*, wchar_t**); + extern "C" long long int wcstoll(const wchar_t*, wchar_t**, int); + extern "C" unsigned long long int wcstoull(const wchar_t*, wchar_t**, int); +#endif +} + #else -# ifdef __cplusplus extern "C" { -#endif typedef struct { int __fill[6]; } mbstate_t; -# ifdef __cplusplus } -# endif + +namespace std +{ + using ::mbstate_t; +} #endif //_GLIBCPP_USE_WCHAR_T -#endif // _CPP_CWCHAR + +#endif diff --git a/libstdc++-v3/include/c/bits/std_cwctype.h b/libstdc++-v3/include/c/bits/std_cwctype.h index c67f2ba9720..5757c14b16b 100644 --- a/libstdc++-v3/include/c/bits/std_cwctype.h +++ b/libstdc++-v3/include/c/bits/std_cwctype.h @@ -31,126 +31,40 @@ // ISO C++ 14882: // +// Note: This is not a conforming implementation. + #ifndef _CPP_CWCTYPE #define _CPP_CWCTYPE 1 -# pragma GCC system_header -# include_next +#pragma GCC system_header +#include_next -// Sequester the C non-inline implementations in the _C_Swamp:: -// namespace, and provide C++ inlines for them in the std:: namespace -// where they belong. - -namespace std +namespace std { + using ::wctype_t; + using ::wctrans_t; -#ifdef towupper - inline wint_t - _S_towupper_helper(wint_t __wc) { return towupper(__wc); } -# undef towupper - inline wint_t - towupper(wint_t __wc) { return _S_towupper_helper(__wc); } -#endif + extern "C" int iswalnum(wint_t); + extern "C" int iswalpha(wint_t); + extern "C" int iswblank(wint_t); + extern "C" int iswcntrl(wint_t); + extern "C" int iswdigit(wint_t); + extern "C" int iswgraph(wint_t); + extern "C" int iswlower(wint_t); + extern "C" int iswprint(wint_t); + extern "C" int iswpunct(wint_t); + extern "C" int iswspace(wint_t); + extern "C" int iswupper(wint_t); + extern "C" int iswxdigit(wint_t); + extern "C" int iswctype(wint_t, wctype_t); + extern "C" wctype_t wctype(const char *); + extern "C" wint_t towlower(wint_t); + extern "C" wint_t towupper(wint_t); + extern "C" wint_t towctrans(wint_t, wctrans_t); + extern "C" wctrans_t wctrans(const char*); +} -#ifdef towlower - inline wint_t - _S_towlower_helper(wint_t __wc) { return towlower(__wc); } -# undef towlower - inline wint_t - towlower(wint_t __wc) { return _S_towlower_helper(__wc); } -#endif - -#ifdef iswspace - inline int - _S_iswspace_helper(wint_t __wc) { return iswspace(__wc); } -# undef iswspace - inline int - iswspace(wint_t __wc) { return _S_iswspace_helper(__wc); } -#endif - -#ifdef iswprint - inline int - _S_iswprint_helper(wint_t __wc) { return iswprint(__wc); } -# undef iswprint - inline int - iswprint(wint_t __wc) { return _S_iswprint_helper(__wc); } -#endif - -#ifdef iswcntrl - inline int - _S_iswcntrl_helper(wint_t __wc) { return iswcntrl(__wc); } -# undef iswcntrl - inline int - iswcntrl(wint_t __wc) { return _S_iswcntrl_helper(__wc); } -#endif - -#ifdef iswupper - inline int - _S_iswupper_helper(wint_t __wc) { return iswupper(__wc); } -# undef iswupper - inline int - iswupper(wint_t __wc) { return _S_iswupper_helper(__wc); } -#endif - -#ifdef iswlower - inline int - _S_iswlower_helper(wint_t __wc) { return iswlower(__wc); } -# undef iswlower - inline int - iswlower(wint_t __wc) { return _S_iswlower_helper(__wc); } -#endif - -#ifdef iswalpha - inline int - _S_iswalpha_helper(wint_t __wc) { return iswalpha(__wc); } -# undef iswalpha - inline int - iswalpha(wint_t __wc) { return _S_iswalpha_helper(__wc); } -#endif - -#ifdef iswdigit - inline int - _S_iswdigit_helper(wint_t __wc) { return iswdigit(__wc); } -# undef iswdigit - inline int - iswdigit(wint_t __wc) { return _S_iswdigit_helper(__wc); } -#endif - -#ifdef iswpunct - inline int - _S_iswpunct_helper(wint_t __wc) { return iswpunct(__wc); } -# undef iswpunct - inline int - iswpunct(wint_t __wc) { return _S_iswpunct_helper(__wc); } -#endif - -#ifdef iswxdigit - inline int - _S_iswxdigit_helper (wint_t __wc) { return iswxdigit(__wc); } -# undef iswxdigit - inline int - iswxdigit(wint_t __wc) { return _S_iswxdigit_helper(__wc); } -#endif - -#ifdef iswalnum - inline int - _S_iswalnum_helper(wint_t __wc) { return iswalnum(__wc); } -# undef iswalnum - inline int - iswalnum(wint_t __wc) { return _S_iswalnum_helper(__wc); } -#endif - -#ifdef iswgraph - inline int - _S_iswgraph_helper(wint_t __wc) { return iswgraph(__wc); } -# undef iswgraph - inline int - iswgraph(wint_t __wc) { return _S_iswgraph_helper(__wc); } -#endif - -} // namespace std - -#endif // _CPP_CWCTYPE +#endif diff --git a/libstdc++-v3/include/c_std/bits/std_cstdio.h b/libstdc++-v3/include/c_std/bits/std_cstdio.h index 7725b676f4c..db2761281d0 100644 --- a/libstdc++-v3/include/c_std/bits/std_cstdio.h +++ b/libstdc++-v3/include/c_std/bits/std_cstdio.h @@ -133,7 +133,7 @@ namespace std { using _C_legacy::remove; using _C_legacy::rename; using _C_legacy::tmpnam; - // using _C_legacy::printf; + using _C_legacy::printf; using _C_legacy::scanf; using _C_legacy::sprintf; using _C_legacy::sscanf; diff --git a/libstdc++-v3/include/c_std/stdio.h b/libstdc++-v3/include/c_std/stdio.h index 58bfccfe3cf..c3a43b736c2 100644 --- a/libstdc++-v3/include/c_std/stdio.h +++ b/libstdc++-v3/include/c_std/stdio.h @@ -57,7 +57,7 @@ using std::setvbuf; using std::fprintf; using std::fscanf; -// using std::printf; + using std::printf; using std::scanf; using std::sprintf; using std::sscanf; diff --git a/libstdc++-v3/libsupc++/tinfo2.cc b/libstdc++-v3/libsupc++/tinfo2.cc index 7c9a764134c..bbcbda79dc5 100644 --- a/libstdc++-v3/libsupc++/tinfo2.cc +++ b/libstdc++-v3/libsupc++/tinfo2.cc @@ -27,7 +27,7 @@ // invalidate any other reasons why the executable file might be covered by // the GNU General Public License. -#include +#include #include "tinfo.h" #include "new" // for placement new diff --git a/libstdc++-v3/mkcheck.in b/libstdc++-v3/mkcheck.in index 23f5dd8d9f2..075558dee99 100755 --- a/libstdc++-v3/mkcheck.in +++ b/libstdc++-v3/mkcheck.in @@ -57,12 +57,12 @@ fi top_srcdir=@top_srcdir@ C_DIR="`basename @C_INCLUDE_DIR@`" if [ $WHICH != "1" ]; then - INC_PATH="@CSHADOW_FLAGS@ -I$BUILD_DIR/include -I$BUILD_DIR/libio \ + INC_PATH="-nostdinc++ @CSHADOW_FLAGS@ -I$BUILD_DIR/include \ -I$SRC_DIR/include/std -I$SRC_DIR/include/$C_DIR \ -I$SRC_DIR/include -I$SRC_DIR/libsupc++ -I$SRC_DIR/libio \ -I$SRC_DIR/testsuite" elif [ $WHICH -eq 1 ]; then - INC_PATH="-I$SRC_DIR/testsuite" + INC_PATH="-nostdinc++ -I$SRC_DIR/testsuite" fi if [ $WHICH -eq 2 ]; then diff --git a/libstdc++-v3/src/complex_io.cc b/libstdc++-v3/src/complex_io.cc index 5fec9cf5290..8b8854c6254 100644 --- a/libstdc++-v3/src/complex_io.cc +++ b/libstdc++-v3/src/complex_io.cc @@ -32,7 +32,6 @@ #include #include - namespace std { @@ -82,9 +81,7 @@ namespace std { basic_ostringstream<_CharT, _Traits> __s; __s.flags(__os.flags()); -#ifdef _G_HAVE_LOCALE __s.imbue(__os.getloc()); -#endif __s.precision (__os.precision()); __s << '(' << __x.real() << "," << __x.imag() << ')' << ends; return __os << __s.str(); diff --git a/libstdc++-v3/testsuite/22_locale/codecvt_wchar_t_char.cc b/libstdc++-v3/testsuite/22_locale/codecvt_wchar_t_char.cc index 7ef07b0443c..91505beef27 100644 --- a/libstdc++-v3/testsuite/22_locale/codecvt_wchar_t_char.cc +++ b/libstdc++-v3/testsuite/22_locale/codecvt_wchar_t_char.cc @@ -20,6 +20,7 @@ // 22.2.1.5 - Template class codecvt [lib.locale.codecvt] +#include // for mbstate_t #include #include @@ -34,8 +35,8 @@ // w_codecvt::state_type state01 = {0, 0}; // .. except Ulrich says: Use memset. Always use memset. Feel the force... void -zero_state(mbstate_t& state) -{ memset(&state, 0, sizeof(mbstate_t)); } +zero_state(std::mbstate_t& state) +{ std::memset(&state, 0, sizeof(std::mbstate_t)); } // Required instantiation // codecvt diff --git a/libstdc++-v3/testsuite/22_locale/ctor_copy_dtor.cc b/libstdc++-v3/testsuite/22_locale/ctor_copy_dtor.cc index 983a28f5aa3..64433ee28b6 100644 --- a/libstdc++-v3/testsuite/22_locale/ctor_copy_dtor.cc +++ b/libstdc++-v3/testsuite/22_locale/ctor_copy_dtor.cc @@ -20,14 +20,15 @@ // 22.1.1.2 locale constructors and destructors [lib.locale.cons] +#include // for mbstate_t #include #include #include -typedef std::codecvt c_codecvt; -typedef std::codecvt_byname c_codecvt_byname; -typedef std::codecvt w_codecvt; -typedef std::codecvt_byname w_codecvt_byname; +typedef std::codecvt c_codecvt; +typedef std::codecvt_byname c_codecvt_byname; +typedef std::codecvt w_codecvt; +typedef std::codecvt_byname w_codecvt_byname; class gnu_codecvt: public c_codecvt { }; diff --git a/libstdc++-v3/testsuite/22_locale/facet.cc b/libstdc++-v3/testsuite/22_locale/facet.cc index cea5fbe7893..8129ea9e048 100644 --- a/libstdc++-v3/testsuite/22_locale/facet.cc +++ b/libstdc++-v3/testsuite/22_locale/facet.cc @@ -20,6 +20,7 @@ // 22.1.1.1.2 - class locale::facet [lib.locale.facet] +#include // for mbstate_t #include #include #include @@ -30,7 +31,7 @@ typedef std::ostreambuf_iterator output_iterator; class gnu_collate: public std::collate { }; class gnu_ctype: public std::ctype { }; -class gnu_codecvt: public std::codecvt { }; +class gnu_codecvt: public std::codecvt { }; class gnu_moneypunct: public std::moneypunct { }; class gnu_moneypunct_true: public std::moneypunct { }; class gnu_money_get: public std::money_get { }; diff --git a/libstdc++-v3/testsuite/22_locale/global_templates.cc b/libstdc++-v3/testsuite/22_locale/global_templates.cc index 74661048222..afd00b060b5 100644 --- a/libstdc++-v3/testsuite/22_locale/global_templates.cc +++ b/libstdc++-v3/testsuite/22_locale/global_templates.cc @@ -20,10 +20,11 @@ // 22.1.2 locale globals [lib.locale.global.templates] +#include // for mbstate_t #include #include -typedef std::codecvt ccodecvt; +typedef std::codecvt ccodecvt; class gnu_codecvt: public ccodecvt { }; diff --git a/libstdc++-v3/testsuite/22_locale/operators.cc b/libstdc++-v3/testsuite/22_locale/operators.cc index e188d2d57eb..e876748d302 100644 --- a/libstdc++-v3/testsuite/22_locale/operators.cc +++ b/libstdc++-v3/testsuite/22_locale/operators.cc @@ -20,10 +20,11 @@ // 22.1.1.4 locale operators [lib.locale.operators] +#include // for mbstate_t #include #include -typedef std::codecvt ccodecvt; +typedef std::codecvt ccodecvt; class gnu_codecvt: public ccodecvt { }; void test01() diff --git a/libstdc++-v3/testsuite/22_locale/static_members.cc b/libstdc++-v3/testsuite/22_locale/static_members.cc index 807ef222255..7f951d81ff8 100644 --- a/libstdc++-v3/testsuite/22_locale/static_members.cc +++ b/libstdc++-v3/testsuite/22_locale/static_members.cc @@ -20,10 +20,11 @@ // 22.1.1.5 locale static members [lib.locale.statics] +#include // for mbstate_t #include #include -typedef std::codecvt ccodecvt; +typedef std::codecvt ccodecvt; class gnu_codecvt: public ccodecvt { }; void test01() diff --git a/libstdc++-v3/testsuite/26_numerics/c_math.cc b/libstdc++-v3/testsuite/26_numerics/c_math.cc index 423adf122ba..119c0d37f0a 100644 --- a/libstdc++-v3/testsuite/26_numerics/c_math.cc +++ b/libstdc++-v3/testsuite/26_numerics/c_math.cc @@ -36,7 +36,7 @@ test01() int test02() { - sin(static_cast(0)); + std::sin(static_cast(0)); return 0; } @@ -44,7 +44,7 @@ test02() int test03() { - double powtest = pow(2., 0); + double powtest = std::pow(2., 0); return 0; } diff --git a/libstdc++-v3/testsuite/26_numerics/complex_inserters_extractors.cc b/libstdc++-v3/testsuite/26_numerics/complex_inserters_extractors.cc index 79575910259..e195651160f 100644 --- a/libstdc++-v3/testsuite/26_numerics/complex_inserters_extractors.cc +++ b/libstdc++-v3/testsuite/26_numerics/complex_inserters_extractors.cc @@ -31,7 +31,7 @@ template inline bool flteq(R x, R y) { if (x == R(0)) return y == R(0); - else return fabs(x-y) < 1e-6*fabs(x); + else return std::fabs(x-y) < 1e-6*std::fabs(x); } template diff --git a/libstdc++-v3/testsuite/27_io/fpos.cc b/libstdc++-v3/testsuite/27_io/fpos.cc index 54c152476ea..ef290bc5d8a 100644 --- a/libstdc++-v3/testsuite/27_io/fpos.cc +++ b/libstdc++-v3/testsuite/27_io/fpos.cc @@ -29,6 +29,7 @@ // 27.4.3 template class fpos +#include // for mbstate_t #include #include @@ -36,7 +37,7 @@ void test01() { bool test = true; - typedef mbstate_t state_type; + typedef std::mbstate_t state_type; state_type state01; state_type state02; @@ -72,7 +73,7 @@ void test02() { bool test = true; - typedef mbstate_t state_type; + typedef std::mbstate_t state_type; state_type state01; state_type state02; @@ -132,7 +133,7 @@ void test03() { bool test = true; - typedef mbstate_t state_type; + typedef std::mbstate_t state_type; state_type state01; state_type state02; diff --git a/libstdc++-v3/testsuite/27_io/istream_extractor_arith.cc b/libstdc++-v3/testsuite/27_io/istream_extractor_arith.cc index d2e55a96a1b..d410f741f16 100644 --- a/libstdc++-v3/testsuite/27_io/istream_extractor_arith.cc +++ b/libstdc++-v3/testsuite/27_io/istream_extractor_arith.cc @@ -20,6 +20,7 @@ // 27.6.1.2.2 arithmetic extractors +#include // for printf #include #include #include @@ -105,9 +106,9 @@ bool test01() { VERIFY( f1 == 1.5 ); is_04 >> std::hex >> i1; - printf ("%d %d %d\n", i1, i1 == 0x123, test); + std::printf ("%d %d %d\n", i1, i1 == 0x123, test); VERIFY( i1 == 0x123 ); - printf ("%d %d %d\n", i1, i1 == 0x123, test); + std::printf ("%d %d %d\n", i1, i1 == 0x123, test); // test void pointers int i = 55; @@ -116,7 +117,7 @@ bool test01() { ss_01 << po; ss_01 >> pi; - printf ("%x %x\n", pi, po); + std::printf ("%x %x\n", pi, po); VERIFY( po == pi ); #ifdef DEBUG_ASSERT diff --git a/libstdc++-v3/testsuite/27_io/istream_unformatted.cc b/libstdc++-v3/testsuite/27_io/istream_unformatted.cc index d34e5784b85..96f47fab99b 100644 --- a/libstdc++-v3/testsuite/27_io/istream_unformatted.cc +++ b/libstdc++-v3/testsuite/27_io/istream_unformatted.cc @@ -20,6 +20,7 @@ // 27.6.1.3 unformatted input functions +#include // for strncmp,... #include #include #include @@ -56,7 +57,7 @@ test01() is_04.read(carray, 9); state2 = is_04.rdstate(); VERIFY( state1 == state2 ); - VERIFY( !strncmp(carray, "soul eyes", 9) ); + VERIFY( !std::strncmp(carray, "soul eyes", 9) ); VERIFY( is_04.peek() == ':' ); state1 = is_03.rdstate(); @@ -65,7 +66,7 @@ test01() VERIFY( state1 != state2 ); VERIFY( static_cast(state2 & stateeof) ); VERIFY( static_cast(state2 & statefail) ); - VERIFY( !strncmp(carray, "soul eyes: john coltrane quartet", 35) ); + VERIFY( !std::strncmp(carray, "soul eyes: john coltrane quartet", 35) ); // istream& ignore(streamsize n = 1, int_type delim = traits::eof()) @@ -377,7 +378,7 @@ aaaaaaaaaaaaaa char tmp[it]; std::stringbuf sb(charray, std::ios_base::in); std::istream ifs(&sb); - std::streamsize blen = strlen(charray); + std::streamsize blen = std::strlen(charray); VERIFY(ifs); while(ifs.getline(tmp, it) || ifs.gcount()) { @@ -401,7 +402,7 @@ aaaaaaaaaaaaaa // or // -> n - 1 characters are stored ifs.clear(ifs.rdstate() & ~std::ios::failbit); - VERIFY((ifs.gcount() == 0) || (strlen(tmp) == it - 1)); + VERIFY((ifs.gcount() == 0) || (std::strlen(tmp) == it - 1)); VERIFY(ifs); continue; } @@ -411,7 +412,7 @@ aaaaaaaaaaaaaa // // -> strlen(__s) < n - 1 // -> delimiter was seen -> gcount() > strlen(__s) - VERIFY(ifs.gcount() == strlen(tmp) + 1); + VERIFY(ifs.gcount() == std::strlen(tmp) + 1); continue; } } diff --git a/libstdc++-v3/testsuite/27_io/ostream_inserter_arith.cc b/libstdc++-v3/testsuite/27_io/ostream_inserter_arith.cc index 722ce1c4597..f503ad37f61 100644 --- a/libstdc++-v3/testsuite/27_io/ostream_inserter_arith.cc +++ b/libstdc++-v3/testsuite/27_io/ostream_inserter_arith.cc @@ -19,6 +19,7 @@ // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. +#include // for sprintf #include #include #include diff --git a/libstdc++-v3/testsuite/27_io/streambuf.cc b/libstdc++-v3/testsuite/27_io/streambuf.cc index 8b7989f6831..17de46b02ea 100644 --- a/libstdc++-v3/testsuite/27_io/streambuf.cc +++ b/libstdc++-v3/testsuite/27_io/streambuf.cc @@ -29,6 +29,7 @@ // 27.5.2 template class basic_streambuf +#include // for memset, memcmp #include #include #include @@ -131,9 +132,9 @@ void test01() // sputn/xsputn char* lit02 = "isotope 217: the unstable molecule on thrill jockey"; - int i02 = strlen(lit02); + int i02 = std::strlen(lit02); char carray[i02 + 1]; - memset(carray, 0, i02 + 1); + std::memset(carray, 0, i02 + 1); buf01.pub_setp(carray, (carray + i02)); buf01.sputn(lit02, 0); @@ -144,9 +145,9 @@ void test01() VERIFY( lit02[1] == 's' ); VERIFY( carray[1] == 0 ); buf01.sputn(lit02 + 1, 10); - VERIFY( memcmp(lit02, carray, 10) == 0 ); + VERIFY( std::memcmp(lit02, carray, 10) == 0 ); buf01.sputn(lit02 + 11, 20); - VERIFY( memcmp(lit02, carray, 30) == 0 ); + VERIFY( std::memcmp(lit02, carray, 30) == 0 ); #ifdef DEBUG_ASSERT assert(test); @@ -172,7 +173,7 @@ void test02() // 27.5.2.2.5 Put area size_t i01 = traits_type::length(lit01); char carray01[i01]; - memset(carray01, 0, i01); + std::memset(carray01, 0, i01); buf01.pub_setg(lit01, lit01, lit01 + i01); buf01.sgetn(carray01, 0);