]> pd.if.org Git - pdclib/commitdiff
Add nothrow annotations where appropriate
authorOwen Shepherd <owen.shepherd@e43.eu>
Tue, 14 Aug 2012 18:31:10 +0000 (19:31 +0100)
committerOwen Shepherd <owen.shepherd@e43.eu>
Tue, 14 Aug 2012 18:31:10 +0000 (19:31 +0100)
includes/ctype.h
includes/inttypes.h
includes/locale.h
includes/stdio.h
includes/stdlib.h
includes/string.h
includes/threads.h
includes/time.h
includes/wchar.h
internals/_PDCLIB_aux.h
internals/_PDCLIB_int.h

index 8f979ef7bb15c2112df8ec4114c78b23e6c93d9a..638a87fcfaa2a66af9e7fc16caab71c72dc8dfa5 100644 (file)
@@ -22,28 +22,28 @@ _PDCLIB_BEGIN_EXTERN_C
 */
 
 /* Returns isalpha( c ) || isdigit( c ) */
-int isalnum( int c );
+int isalnum( int c ) _PDCLIB_nothrow;
 
 /* Returns isupper( c ) || islower( c ) in the "C" locale.
    In any other locale, also returns true for a locale-specific set of
    alphabetic characters which are neither control characters, digits,
    punctation, or whitespace.
 */
-int isalpha( int c );
+int isalpha( int c ) _PDCLIB_nothrow;
 
 /* Returns true if the character isspace() and used for seperating words within
    a line of text. In the "C" locale, only ' ' and '\t' are considered blanks.
 */
-int isblank( int c );
+int isblank( int c ) _PDCLIB_nothrow;
 
 /* Returns true if the character is a control character. */
-int iscntrl( int c );
+int iscntrl( int c ) _PDCLIB_nothrow;
 
 /* Returns true if the character is a decimal digit. Locale-independent. */
-int isdigit( int c );
+int isdigit( int c ) _PDCLIB_nothrow;
 
 /* Returns true for every printing character except space (' '). */
-int isgraph( int c );
+int isgraph( int c ) _PDCLIB_nothrow;
 
 /* Returns true for lowercase letters in the "C" locale.
    In any other locale, also returns true for a locale-specific set of
@@ -51,23 +51,23 @@ int isgraph( int c );
    space (' '). In a locale other than the "C" locale, a character might test
    true for both islower() and isupper().
 */
-int islower( int c );
+int islower( int c ) _PDCLIB_nothrow;
 
 /* Returns true for every printing character including space (' '). */
-int isprint( int c );
+int isprint( int c ) _PDCLIB_nothrow;
 
 /* Returns true for every printing character that is neither whitespace
    nor alphanumeric in the "C" locale. In any other locale, there might be
    characters that are printing characters, but neither whitespace nor
    alphanumeric.
 */
-int ispunct( int c );
+int ispunct( int c ) _PDCLIB_nothrow;
 
 /* Returns true for every standard whitespace character (' ', '\f', '\n', '\r',
    '\t', '\v') in the "C" locale. In any other locale, also returns true for a
    locale-specific set of characters for which isalnum() is false.
 */ 
-int isspace( int c );
+int isspace( int c ) _PDCLIB_nothrow;
 
 /* Returns true for uppercase letters in the "C" locale.
    In any other locale, also returns true for a locale-specific set of
@@ -75,22 +75,22 @@ int isspace( int c );
    space (' '). In a locale other than the "C" locale, a character might test
    true for both islower() and isupper().
 */
-int isupper( int c );
+int isupper( int c ) _PDCLIB_nothrow;
 
 /* Returns true for any hexadecimal-digit character. Locale-independent. */
-int isxdigit( int c );
+int isxdigit( int c ) _PDCLIB_nothrow;
 
 /* Character case mapping functions */
 
 /* Converts an uppercase letter to a corresponding lowercase letter. Input that
    is not an uppercase letter remains unchanged.
 */
-int tolower( int c );
+int tolower( int c ) _PDCLIB_nothrow;
 
 /* Converts a lowercase letter to a corresponding uppercase letter. Input that
    is not a lowercase letter remains unchanged.
 */
-int toupper( int c );
+int toupper( int c ) _PDCLIB_nothrow;
 
 _PDCLIB_END_EXTERN_C
 #endif
index 231dfab9408a87df3286500ff31fcf57ad0807af..32dd629f348ff604d73814d622958f19ec87fce2 100644 (file)
@@ -214,12 +214,12 @@ typedef struct _PDCLIB_imaxdiv_t imaxdiv_t;
 /* 7.8.2 Functions for greatest-width integer types */
 
 /* Calculate the absolute value of j */
-intmax_t imaxabs( intmax_t j );
+intmax_t imaxabs( intmax_t j ) _PDCLIB_nothrow;
 
 /* Return quotient (quot) and remainder (rem) of an integer division in the
    imaxdiv_t struct.
 */
-imaxdiv_t imaxdiv( intmax_t numer, intmax_t denom );
+imaxdiv_t imaxdiv( intmax_t numer, intmax_t denom ) _PDCLIB_nothrow;
 
 /* Seperate the character array nptr into three parts: A (possibly empty)
    sequence of whitespace characters, a character representation of an integer
@@ -243,8 +243,8 @@ imaxdiv_t imaxdiv( intmax_t numer, intmax_t denom );
 /* This function is equivalent to strtol() / strtoul() in <stdlib.h>, but on
    the potentially larger type.
 */
-intmax_t strtoimax( const char * _PDCLIB_restrict nptr, char * * _PDCLIB_restrict endptr, int base );
-uintmax_t strtoumax( const char * _PDCLIB_restrict nptr, char * * _PDCLIB_restrict endptr, int base );
+intmax_t strtoimax( const char * _PDCLIB_restrict nptr, char * * _PDCLIB_restrict endptr, int base ) _PDCLIB_nothrow;
+uintmax_t strtoumax( const char * _PDCLIB_restrict nptr, char * * _PDCLIB_restrict endptr, int base ) _PDCLIB_nothrow;
 
 /* TODO: wcstoimax(), wcstoumax() */
 
index 6d9d4829dd88cad2c61d463e7aec3dcc9e565057..14996bbb98be6709561d9578cec53d34845d6966 100644 (file)
@@ -90,12 +90,12 @@ extern struct lconv _PDCLIB_lconv;
    Otherwise, returns a pointer to a string associated with the specified
    category for the new locale.
 */
-char * setlocale( int category, const char * locale );
+char * setlocale( int category, const char * locale ) _PDCLIB_nothrow;
 
 /* Returns a struct lconv initialized to the values appropriate for the current
    locale setting.
 */
-struct lconv * localeconv( void );
+struct lconv * localeconv( void ) _PDCLIB_nothrow;
 
 _PDCLIB_END_EXTERN_C
 #endif
index 12b7f0aea2aa1ea51a06f4b93c7d9556735f816c..b5c8abeb618a676e03cc58f0bcd413b714e62c12 100644 (file)
@@ -71,7 +71,7 @@ extern FILE * stderr;
    and fails the remove in this case. This does not detect two distinct names
    that merely result in the same file (e.g. "/home/user/foo" vs. "~/foo").
 */
-int remove( const char * filename );
+int remove( const char * filename ) _PDCLIB_nothrow;
 
 /* Rename the given old file to the given new name.
    Returns zero if successful, non-zero otherwise. 
@@ -80,7 +80,7 @@ int remove( const char * filename );
    If there already is a file with the new filename, behaviour is defined by
    the glue code (see functions/_PDCLIB/rename.c).
 */
-int rename( const char * old, const char * newn );
+int rename( const char * old, const char * newn ) _PDCLIB_nothrow;
 
 /* Open a temporary file with mode "wb+", i.e. binary-update. Remove the file
    automatically if it is closed or the program exits normally (by returning
@@ -89,7 +89,7 @@ int rename( const char * old, const char * newn );
    This implementation does not remove temporary files if the process aborts
    abnormally (e.g. abort()).
 */
-FILE * tmpfile( void );
+FILE * tmpfile( void ) _PDCLIB_nothrow;
 
 /* Generate a file name that is not equal to any existing filename AT THE TIME
    OF GENERATION. Generate a different name each time it is called.
@@ -102,14 +102,14 @@ FILE * tmpfile( void );
    Note that this implementation cannot guarantee a file of the name generated
    is not generated between the call to this function and a subsequent fopen().
 */
-char * tmpnam( char * s );
+char * tmpnam( char * s ) _PDCLIB_nothrow;
 
 /* File access functions */
 
 /* Close the file associated with the given stream (after flushing its buffers).
    Returns zero if successful, EOF if any errors occur.
 */
-int fclose( FILE * stream );
+int fclose( FILE * stream ) _PDCLIB_nothrow;
 
 /* Flush the buffers of the given output stream. If the stream is an input
    stream, or an update stream with the last operation being an input operation,
@@ -119,7 +119,7 @@ int fclose( FILE * stream );
    Returns zero if successful, EOF if a write error occurs.
    Sets the error indicator of the stream if a write error occurs.
 */
-int fflush( FILE * stream );
+int fflush( FILE * stream ) _PDCLIB_nothrow;
 
 /* Open the file with the given filename in the given mode, and return a stream
    handle for it in which error and end-of-file indicator are cleared. Defined
@@ -171,12 +171,12 @@ int fflush( FILE * stream );
 
    Returns a pointer to the stream handle if successfull, NULL otherwise.
 */
-FILE * fopen( const char * _PDCLIB_restrict filename, const char * _PDCLIB_restrict mode );
+FILE * fopen( const char * _PDCLIB_restrict filename, const char * _PDCLIB_restrict mode ) _PDCLIB_nothrow;
 
 /* Creates a stream connected to the file descriptor \p fd with mode \p mode.
    Mode must match the mode with which the file descriptor was opened.
 */
-FILE * _PDCLIB_fdopen( _PDCLIB_fd_t fd, int mode, const char* filename );
+FILE * _PDCLIB_fdopen( _PDCLIB_fd_t fd, int mode, const char* filename ) _PDCLIB_nothrow;
 
 /* Close any file currently associated with the given stream. Open the file
    identified by the given filename with the given mode (equivalent to fopen()),
@@ -187,12 +187,12 @@ FILE * _PDCLIB_fdopen( _PDCLIB_fd_t fd, int mode, const char* filename );
    standard streams.
    (Primary use of this function is to redirect stdin, stdout, and stderr.)
 */
-FILE * freopen( const char * _PDCLIB_restrict filename, const char * _PDCLIB_restrict mode, FILE * _PDCLIB_restrict stream );
+FILE * freopen( const char * _PDCLIB_restrict filename, const char * _PDCLIB_restrict mode, FILE * _PDCLIB_restrict stream ) _PDCLIB_nothrow;
 
 /* If buf is a NULL pointer, call setvbuf( stream, NULL, _IONBF, BUFSIZ ).
    If buf is not a NULL pointer, call setvbuf( stream, buf, _IOFBF, BUFSIZ ).
 */
-void setbuf( FILE * _PDCLIB_restrict stream, char * _PDCLIB_restrict buf );
+void setbuf( FILE * _PDCLIB_restrict stream, char * _PDCLIB_restrict buf ) _PDCLIB_nothrow;
 
 /* Set the given stream to the given buffering mode. If buf is not a NULL
    pointer, use buf as file buffer (of given size). If buf is a NULL pointer,
@@ -203,7 +203,7 @@ void setbuf( FILE * _PDCLIB_restrict stream, char * _PDCLIB_restrict buf );
    setvbuf()) has been performed.
    Returns zero if successful, nonzero otherwise.
 */
-int setvbuf( FILE * _PDCLIB_restrict stream, char * _PDCLIB_restrict buf, int mode, size_t size );
+int setvbuf( FILE * _PDCLIB_restrict stream, char * _PDCLIB_restrict buf, int mode, size_t size ) _PDCLIB_nothrow;
 
 /* Formatted input/output functions */
 
@@ -418,7 +418,7 @@ int setvbuf( FILE * _PDCLIB_restrict stream, char * _PDCLIB_restrict buf, int mo
    Returns the number of characters written if successful, a negative value
    otherwise.
 */
-int fprintf( FILE * _PDCLIB_restrict stream, const char * _PDCLIB_restrict format, ... );
+int fprintf( FILE * _PDCLIB_restrict stream, const char * _PDCLIB_restrict format, ... ) _PDCLIB_nothrow;
 
 /* TODO: fscanf() documentation */
 /*
@@ -571,13 +571,13 @@ int fprintf( FILE * _PDCLIB_restrict stream, const char * _PDCLIB_restrict forma
    an early mismatch occurs. Returns EOF if an input failure occurs before the
    first conversion.
 */
-int fscanf( FILE * _PDCLIB_restrict stream, const char * _PDCLIB_restrict format, ... );
+int fscanf( FILE * _PDCLIB_restrict stream, const char * _PDCLIB_restrict format, ... ) _PDCLIB_nothrow;
 
 /* Equivalent to fprintf( stdout, format, ... ). */
-int printf( const char * _PDCLIB_restrict format, ... );
+int printf( const char * _PDCLIB_restrict format, ... ) _PDCLIB_nothrow;
 
 /* Equivalent to fscanf( stdin, format, ... ). */
-int scanf( const char * _PDCLIB_restrict format, ... );
+int scanf( const char * _PDCLIB_restrict format, ... ) _PDCLIB_nothrow;
 
 /* Equivalent to fprintf( stdout, format, ... ), except that the result is
    written into the buffer pointed to by s, instead of stdout, and that any
@@ -587,61 +587,61 @@ int scanf( const char * _PDCLIB_restrict format, ... );
    the terminating '\0' character) if n had been sufficiently large, if
    successful, and a negative number if an encoding error ocurred.
 */
-int snprintf( char * _PDCLIB_restrict s, size_t n, const char * _PDCLIB_restrict format, ... );
+int snprintf( char * _PDCLIB_restrict s, size_t n, const char * _PDCLIB_restrict format, ... ) _PDCLIB_nothrow;
 
 /* Equivalent to fprintf( stdout, format, ... ), except that the result is
    written into the buffer pointed to by s, instead of stdout.
 */
-int sprintf( char * _PDCLIB_restrict s, const char * _PDCLIB_restrict format, ... );
+int sprintf( char * _PDCLIB_restrict s, const char * _PDCLIB_restrict format, ... ) _PDCLIB_nothrow;
 
 /* Equivalent to fscanf( stdin, format, ... ), except that the input is read
    from the buffer pointed to by s, instead of stdin.
 */
-int sscanf( const char * _PDCLIB_restrict s, const char * _PDCLIB_restrict format, ... );
+int sscanf( const char * _PDCLIB_restrict s, const char * _PDCLIB_restrict format, ... ) _PDCLIB_nothrow;
 
 /* Equivalent to fprintf( stream, format, ... ), except that the argument stack
    is passed as va_list parameter. Note that va_list is not declared by
    <stdio.h>.
 */
-int vfprintf( FILE * _PDCLIB_restrict stream, const char * _PDCLIB_restrict format, _PDCLIB_va_list arg );
+int vfprintf( FILE * _PDCLIB_restrict stream, const char * _PDCLIB_restrict format, _PDCLIB_va_list arg ) _PDCLIB_nothrow;
 
 /* Equivalent to fscanf( stream, format, ... ), except that the argument stack
    is passed as va_list parameter. Note that va_list is not declared by
    <stdio.h>.
 */
-int vfscanf( FILE * _PDCLIB_restrict stream, const char * _PDCLIB_restrict format, _PDCLIB_va_list arg );
+int vfscanf( FILE * _PDCLIB_restrict stream, const char * _PDCLIB_restrict format, _PDCLIB_va_list arg ) _PDCLIB_nothrow;
 
 /* Equivalent to fprintf( stdout, format, ... ), except that the argument stack
    is passed as va_list parameter. Note that va_list is not declared by
    <stdio.h>.
 */
-int vprintf( const char * _PDCLIB_restrict format, _PDCLIB_va_list arg );
+int vprintf( const char * _PDCLIB_restrict format, _PDCLIB_va_list arg ) _PDCLIB_nothrow;
 
 /* Equivalent to fscanf( stdin, format, ... ), except that the argument stack
    is passed as va_list parameter. Note that va_list is not declared by
    <stdio.h>.
 */
-int vscanf( const char * _PDCLIB_restrict format, _PDCLIB_va_list arg );
+int vscanf( const char * _PDCLIB_restrict format, _PDCLIB_va_list arg ) _PDCLIB_nothrow;
 
 /* Equivalent to snprintf( s, n, format, ... ), except that the argument stack
    is passed as va_list parameter. Note that va_list is not declared by
    <stdio.h>.
    */
-int vsnprintf( char * _PDCLIB_restrict s, size_t n, const char * _PDCLIB_restrict format, _PDCLIB_va_list arg );
+int vsnprintf( char * _PDCLIB_restrict s, size_t n, const char * _PDCLIB_restrict format, _PDCLIB_va_list arg ) _PDCLIB_nothrow;
 
 /* Equivalent to fprintf( stdout, format, ... ), except that the argument stack
    is passed as va_list parameter, and the result is written to the buffer
    pointed to by s, instead of stdout. Note that va_list is not declared by
    <stdio.h>.
 */
-int vsprintf( char * _PDCLIB_restrict s, const char * _PDCLIB_restrict format, _PDCLIB_va_list arg );
+int vsprintf( char * _PDCLIB_restrict s, const char * _PDCLIB_restrict format, _PDCLIB_va_list arg ) _PDCLIB_nothrow;
 
 /* Equivalent to fscanf( stdin, format, ... ), except that the argument stack
    is passed as va_list parameter, and the input is read from the buffer
    pointed to by s, instead of stdin. Note that va_list is not declared by
    <stdio.h>.
 */
-int vsscanf( const char * _PDCLIB_restrict s, const char * _PDCLIB_restrict format, _PDCLIB_va_list arg );
+int vsscanf( const char * _PDCLIB_restrict s, const char * _PDCLIB_restrict format, _PDCLIB_va_list arg ) _PDCLIB_nothrow;
 
 /* Character input/output functions */
 
@@ -650,7 +650,7 @@ int vsscanf( const char * _PDCLIB_restrict s, const char * _PDCLIB_restrict form
    If end-of-file is reached, the EOF indicator of the stream is set.
    If a read error occurs, the error indicator of the stream is set.
 */
-int fgetc( FILE * stream );
+int fgetc( FILE * stream ) _PDCLIB_nothrow;
 
 /* Read at most n-1 characters from given stream into the array s, stopping at
    \n or EOF. Terminate the read string with \n. If EOF is encountered before
@@ -659,28 +659,28 @@ int fgetc( FILE * stream );
    If a read error occurs, the error indicator of the stream is set. In this
    case, the contents of s are indeterminate.
 */
-char * fgets( char * _PDCLIB_restrict s, int n, FILE * _PDCLIB_restrict stream );
+char * fgets( char * _PDCLIB_restrict s, int n, FILE * _PDCLIB_restrict stream ) _PDCLIB_nothrow;
 
 /* Write the value c (cast to unsigned char) to the given stream.
    Returns c if successful, EOF otherwise.
    If a write error occurs, sets the error indicator of the stream is set.
 */
-int fputc( int c, FILE * stream );
+int fputc( int c, FILE * stream ) _PDCLIB_nothrow;
 
 /* Write the string s (not including the terminating \0) to the given stream.
    Returns a value >=0 if successful, EOF otherwise.
    This implementation does set the error indicator of the stream if a write
    error occurs.
 */
-int fputs( const char * _PDCLIB_restrict s, FILE * _PDCLIB_restrict stream );
+int fputs( const char * _PDCLIB_restrict s, FILE * _PDCLIB_restrict stream ) _PDCLIB_nothrow;
 
 /* Equivalent to fgetc( stream ), but may be overloaded by a macro that
    evaluates its parameter more than once.
 */
-int getc( FILE * stream );
+int getc( FILE * stream ) _PDCLIB_nothrow;
 
 /* Equivalent to fgetc( stdin ). */
-int getchar( void );
+int getchar( void ) _PDCLIB_nothrow;
 
 /* Read characters from given stream into the array s, stopping at \n or EOF.
    The string read is terminated with \0. Returns s if successful. If EOF is
@@ -688,23 +688,23 @@ int getchar( void );
    and NULL is returned. If a read error occurs, the contents of s are indeter-
    minate, and NULL is returned.
 */
-char * gets( char * s );
+char * gets( char * s ) _PDCLIB_nothrow;
 
 /* Equivalent to fputc( c, stream ), but may be overloaded by a macro that
    evaluates its parameter more than once.
 */
-int putc( int c, FILE * stream );
+int putc( int c, FILE * stream ) _PDCLIB_nothrow;
 
 /* Equivalent to fputc( c, stdout ), but may be overloaded by a macro that
    evaluates its parameter more than once.
 */
-int putchar( int c );
+int putchar( int c ) _PDCLIB_nothrow;
 
 /* Write the string s (not including the terminating \0) to stdout, and append
    a newline to the output. Returns a value >= 0 when successful, EOF if a
    write error occurred.
 */
-int puts( const char * s );
+int puts( const char * s ) _PDCLIB_nothrow;
 
 /* Push the value c (cast to unsigned char) back onto the given (input) stream.
    A character pushed back in this way will be delivered by subsequent read
@@ -720,7 +720,7 @@ int puts( const char * s );
    behaviour is undefined. (Older versions of the library allowed such a call.)
    Returns the pushed-back character if successful, EOF if it fails.
 */
-int ungetc( int c, FILE * stream );
+int ungetc( int c, FILE * stream ) _PDCLIB_nothrow;
 
 /* Direct input/output functions */
 
@@ -731,7 +731,7 @@ int ungetc( int c, FILE * stream );
    indeterminate. If a partial element is read, its value is indeterminate.
    If size or nmemb are zero, the function does nothing and returns zero.
 */
-size_t fread( void * _PDCLIB_restrict ptr, size_t size, size_t nmemb, FILE * _PDCLIB_restrict stream );
+size_t fread( void * _PDCLIB_restrict ptr, size_t size, size_t nmemb, FILE * _PDCLIB_restrict stream ) _PDCLIB_nothrow;
 
 /* Write up to nmemb elements of given size from buffer pointed to by ptr to
    the given stream. Returns the number of elements successfully written, which
@@ -740,7 +740,7 @@ size_t fread( void * _PDCLIB_restrict ptr, size_t size, size_t nmemb, FILE * _PD
    indeterminate. If size or nmemb are zero, the function does nothing and
    returns zero.
 */
-size_t fwrite( const void * _PDCLIB_restrict ptr, size_t size, size_t nmemb, FILE * _PDCLIB_restrict stream );
+size_t fwrite( const void * _PDCLIB_restrict ptr, size_t size, size_t nmemb, FILE * _PDCLIB_restrict stream ) _PDCLIB_nothrow;
 
 /* File positioning functions */
 
@@ -752,7 +752,7 @@ size_t fwrite( const void * _PDCLIB_restrict ptr, size_t size, size_t nmemb, FIL
    Returns zero if successful, nonzero otherwise.
    TODO: Implementation-defined errno setting for fgetpos().
 */
-int fgetpos( FILE * _PDCLIB_restrict stream, fpos_t * _PDCLIB_restrict pos );
+int fgetpos( FILE * _PDCLIB_restrict stream, fpos_t * _PDCLIB_restrict pos ) _PDCLIB_nothrow;
 
 /* Set the position indicator for the given stream to the given offset from:
    - the beginning of the file if whence is SEEK_SET,
@@ -766,7 +766,7 @@ int fgetpos( FILE * _PDCLIB_restrict stream, fpos_t * _PDCLIB_restrict pos );
    Returns zero if successful, nonzero otherwise. If a read/write error occurs,
    the error indicator for the given stream is set.
 */
-int fseek( FILE * stream, long int offset, int whence );
+int fseek( FILE * stream, long int offset, int whence ) _PDCLIB_nothrow;
 
 /* Set the position indicator (and, where appropriate the mbstate_t status
    object) for the given stream to the given pos object (created by an earlier
@@ -778,7 +778,7 @@ int fseek( FILE * stream, long int offset, int whence );
    the error indicator for the given stream is set.
    TODO: Implementation-defined errno setting for fsetpos().
 */
-int fsetpos( FILE * stream, const fpos_t * pos );
+int fsetpos( FILE * stream, const fpos_t * pos ) _PDCLIB_nothrow;
 
 /* Return the current offset of the given stream from the beginning of the
    associated file. For text streams, the exact value returned is unspecified
@@ -787,34 +787,34 @@ int fsetpos( FILE * stream, const fpos_t * pos );
    Returns -1L if unsuccessful.
    TODO: Implementation-defined errno setting for ftell().
 */
-long int ftell( FILE * stream );
+long int ftell( FILE * stream ) _PDCLIB_nothrow;
 
 /* Equivalent to (void)fseek( stream, 0L, SEEK_SET ), except that the error
    indicator for the stream is also cleared.
 */
-void rewind( FILE * stream );
+void rewind( FILE * stream ) _PDCLIB_nothrow;
 
 /* Error-handling functions */
 
 /* Clear the end-of-file and error indicators for the given stream. */
-void clearerr( FILE * stream );
+void clearerr( FILE * stream ) _PDCLIB_nothrow;
 
 /* Return zero if the end-of-file indicator for the given stream is not set,
    nonzero otherwise.
 */
-int feof( FILE * stream );
+int feof( FILE * stream ) _PDCLIB_nothrow;
 
 /* Return zero if the error indicator for the given stream is not set, nonzero
    otherwise.
 */
-int ferror( FILE * stream );
+int ferror( FILE * stream ) _PDCLIB_nothrow;
 
 /* If s is neither a NULL pointer nor an empty string, print the string to
    stderr (with appended colon (':') and a space) first. In any case, print an
    error message depending on the current value of errno (being the same as if
    strerror( errno ) had been called).
 */
-void perror( const char * s );
+void perror( const char * s ) _PDCLIB_nothrow;
 
 _PDCLIB_END_EXTERN_C
 #endif
index 15f07b026c2d4da7a723249f22803135e2a2f234..22cc80c72b5e52011897f5a9b3fd2b05c7868fa9 100644 (file)
@@ -25,10 +25,10 @@ typedef _PDCLIB_size_t size_t;
 
 /* TODO: atof(), strtof(), strtod(), strtold() */
 
-double atof( const char * nptr );
-double strtod( const char * _PDCLIB_restrict nptr, char * * _PDCLIB_restrict endptr );
-float strtof( const char * _PDCLIB_restrict nptr, char * * _PDCLIB_restrict endptr );
-long double strtold( const char * _PDCLIB_restrict nptr, char * * _PDCLIB_restrict endptr );
+double atof( const char * nptr ) _PDCLIB_nothrow;
+double strtod( const char * _PDCLIB_restrict nptr, char * * _PDCLIB_restrict endptr ) _PDCLIB_nothrow;
+float strtof( const char * _PDCLIB_restrict nptr, char * * _PDCLIB_restrict endptr ) _PDCLIB_nothrow;
+long double strtold( const char * _PDCLIB_restrict nptr, char * * _PDCLIB_restrict endptr ) _PDCLIB_nothrow;
 
 /* Seperate the character array nptr into three parts: A (possibly empty)
    sequence of whitespace characters, a character representation of an integer
@@ -52,10 +52,10 @@ long double strtold( const char * _PDCLIB_restrict nptr, char * * _PDCLIB_restri
 /* There is strtoimax() and strtoumax() in <inttypes.h> operating on intmax_t /
    uintmax_t, if the long long versions do not suit your needs.
 */
-long int strtol( const char * _PDCLIB_restrict nptr, char * * _PDCLIB_restrict endptr, int base );
-long long int strtoll( const char * _PDCLIB_restrict nptr, char * * _PDCLIB_restrict endptr, int base );
-unsigned long int strtoul( const char * _PDCLIB_restrict nptr, char * * _PDCLIB_restrict endptr, int base );
-unsigned long long int strtoull( const char * _PDCLIB_restrict nptr, char * * _PDCLIB_restrict endptr, int base );
+long int strtol( const char * _PDCLIB_restrict nptr, char * * _PDCLIB_restrict endptr, int base ) _PDCLIB_nothrow;
+long long int strtoll( const char * _PDCLIB_restrict nptr, char * * _PDCLIB_restrict endptr, int base ) _PDCLIB_nothrow;
+unsigned long int strtoul( const char * _PDCLIB_restrict nptr, char * * _PDCLIB_restrict endptr, int base ) _PDCLIB_nothrow;
+unsigned long long int strtoull( const char * _PDCLIB_restrict nptr, char * * _PDCLIB_restrict endptr, int base ) _PDCLIB_nothrow;
 
 /* These functions are the equivalent of (int)strtol( nptr, NULL, 10 ),
    strtol( nptr, NULL, 10 ) and strtoll(nptr, NULL, 10 ) respectively, with the
@@ -65,9 +65,9 @@ unsigned long long int strtoull( const char * _PDCLIB_restrict nptr, char * * _P
    provides a simpler atox() function that saves a couple of tests and simply
    continues with the conversion in case of overflow.)
 */
-int atoi( const char * nptr );
-long int atol( const char * nptr );
-long long int atoll( const char * nptr );
+int atoi( const char * nptr ) _PDCLIB_nothrow;
+long int atol( const char * nptr ) _PDCLIB_nothrow;
+long long int atoll( const char * nptr ) _PDCLIB_nothrow;
 
 /* Pseudo-random sequence generation functions */
 
@@ -80,12 +80,12 @@ extern unsigned long int _PDCLIB_seed;
    (PDCLib uses the implementation suggested by the standard document, which is
    next = next * 1103515245 + 12345; return (unsigned int)(next/65536) % 32768;)
 */
-int rand( void );
+int rand( void ) _PDCLIB_nothrow;
 
 /* Initialize a new pseudo-random sequence with the starting seed. Same seeds
    result in the same pseudo-random sequence. The default seed is 1.
 */
-void srand( unsigned int seed );
+void srand( unsigned int seed ) _PDCLIB_nothrow;
 
 /* Memory management functions */
 
@@ -93,21 +93,21 @@ void srand( unsigned int seed );
    satisfied, return NULL. Otherwise, return a pointer to the allocated
    memory. Memory contents are undefined.
 */
-void * malloc( size_t size );
+void * malloc( size_t size ) _PDCLIB_nothrow;
 
 /* Allocate a chunk of heap memory that is large enough to hold nmemb elements
    of the given size, and zero-initialize that memory. If request could not be
    satisfied, return NULL. Otherwise, return a pointer to the allocated
    memory.
 */
-void * calloc( size_t nmemb, size_t size );
+void * calloc( size_t nmemb, size_t size ) _PDCLIB_nothrow;
 
 /* De-allocate a chunk of heap memory previously allocated using malloc(),
    calloc(), or realloc(), and pointed to by ptr. If ptr does not match a
    pointer previously returned by the mentioned allocation functions, or
    free() has already been called for this ptr, behaviour is undefined.
 */
-void free( void * ptr );
+void free( void * ptr ) _PDCLIB_nothrow;
 
 /* Resize a chunk of memory previously allocated with malloc() and pointed to
    by ptr to the given size (which might be larger or smaller than the original
@@ -118,7 +118,7 @@ void free( void * ptr );
    memory beyond the original size is undefined. If ptr is NULL, realloc()
    behaves like malloc().
 */
-void * realloc( void * ptr, size_t size );
+void * realloc( void * ptr, size_t size ) _PDCLIB_nothrow;
 
 /* Communication with the environment */
 
@@ -138,14 +138,14 @@ void * realloc( void * ptr, size_t size );
    temporary files before exiting with EXIT_FAILURE.
    abort() does not return.
 */
-_PDCLIB_noreturn void abort( void );
+_PDCLIB_noreturn void abort( void ) _PDCLIB_nothrow;
 
 /* Register a function that will be called on exit(), or when main() returns.
    At least 32 functions can be registered this way, and will be called in
    reverse order of registration (last-in, first-out).
    Returns zero if registration is successfull, nonzero if it failed.
 */
-int atexit( void (*func)( void ) ); 
+int atexit( void (*func)( void ) ) _PDCLIB_nothrow
 
 /* Normal process termination. Functions registered by atexit() (see above) are
    called, streams flushed, files closed and temporary files removed before the
@@ -153,7 +153,7 @@ int atexit( void (*func)( void ) );
    and EXIT_FAILURE above.)
    exit() does not return.
 */
-_PDCLIB_noreturn void exit( int status );
+_PDCLIB_noreturn void exit( int status ) _PDCLIB_nothrow;
 
 /* Normal process termination. Functions registered by atexit() (see above) are
    NOT CALLED. This implementation DOES flush streams, close files and removes
@@ -161,7 +161,7 @@ _PDCLIB_noreturn void exit( int status );
    comment for EXIT_SUCCESS and EXIT_FAILURE above.)
    _Exit() does not return.
 */
-_PDCLIB_noreturn void _Exit( int status );
+_PDCLIB_noreturn void _Exit( int status ) _PDCLIB_nothrow;
 
 /* Search an environment-provided key-value map for the given key name, and
    return a pointer to the associated value string (or NULL if key name cannot
@@ -170,14 +170,14 @@ _PDCLIB_noreturn void _Exit( int status );
    Details on the provided keys and how to set / change them are determined by
    the hosting OS and its glue function.
 */
-char * getenv( const char * name );
+char * getenv( const char * name ) _PDCLIB_nothrow;
 
 /* If string is a NULL pointer, system() returns nonzero if a command processor
    is available, and zero otherwise. If string is not a NULL pointer, it is
    passed to the command processor. If system() returns, it does so with a
    value that is determined by the hosting OS and its glue function.
 */
-int system( const char * string );
+int system( const char * string ) _PDCLIB_nothrow;
 
 /* Searching and sorting */
 
@@ -190,6 +190,8 @@ int system( const char * string );
    greater than the array element, respectively.
    The function returns a pointer to the first matching element found, or NULL
    if no match is found.
+
+   ** May throw **
 */
 void * bsearch( const void * key, const void * base, size_t nmemb, size_t size, int (*compar)( const void *, const void * ) );
 
@@ -200,6 +202,8 @@ void * bsearch( const void * key, const void * base, size_t nmemb, size_t size,
    to be less than, equal to, or greater than the second argument, respectively.
    If two elements are compared equal, their order in the sorted array is not
    specified.
+
+   ** May throw **
 */
 void qsort( void * base, size_t nmemb, size_t size, int (*compar)( const void *, const void * ) );
 
@@ -209,9 +213,9 @@ void qsort( void * base, size_t nmemb, size_t size, int (*compar)( const void *,
    complement's notation (most modern CPUs), the largest negative value cannot
    be represented as positive value. In this case, behaviour is unspecified.
 */
-int abs( int j );
-long int labs( long int j );
-long long int llabs( long long int j );
+int abs( int j ) _PDCLIB_nothrow;
+long int labs( long int j ) _PDCLIB_nothrow;
+long long int llabs( long long int j ) _PDCLIB_nothrow;
 
 /* These structures each have a member quot and a member rem, of type int (for
    div_t), long int (for ldiv_t) and long long it (for lldiv_t) respectively.
@@ -225,9 +229,9 @@ typedef struct _PDCLIB_lldiv_t lldiv_t;
 /* Return quotient (quot) and remainder (rem) of an integer division in one of
    the structs above.
 */
-div_t div( int numer, int denom );
-ldiv_t ldiv( long int numer, long int denom );
-lldiv_t lldiv( long long int numer, long long int denom );
+div_t div( int numer, int denom ) _PDCLIB_nothrow;
+ldiv_t ldiv( long int numer, long int denom ) _PDCLIB_nothrow;
+lldiv_t lldiv( long long int numer, long long int denom ) _PDCLIB_nothrow;
 
 /* TODO: Multibyte / wide character conversion functions */
 
index 636231929ba351fc668aac3d76832325bcc9477e..8c688e903cc0c77e352e8eb858b05b262e37d14e 100644 (file)
@@ -35,19 +35,19 @@ typedef _PDCLIB_size_t size_t;
    area pointed to by s1. If the two areas overlap, behaviour is undefined.
    Returns the value of s1.
 */
-void * memcpy( void * _PDCLIB_restrict s1, const void * _PDCLIB_restrict s2, size_t n );
+void * memcpy( void * _PDCLIB_restrict s1, const void * _PDCLIB_restrict s2, size_t n ) _PDCLIB_nothrow;
 
 /* Copy a number of n characters from the memory area pointed to by s2 to the
    area pointed to by s1. The two areas may overlap.
    Returns the value of s1.
 */
-void * memmove( void * s1, const void * , size_t n );
+void * memmove( void * s1, const void * , size_t n ) _PDCLIB_nothrow;
 
 /* Copy the character array s2 (including terminating '\0' byte) into the
    character array s1.
    Returns the value of s1.
 */
-char * strcpy( char * _PDCLIB_restrict s1, const char * _PDCLIB_restrict s2 );
+char * strcpy( char * _PDCLIB_restrict s1, const char * _PDCLIB_restrict s2 ) _PDCLIB_nothrow;
 
 /* Copy a maximum of n characters from the character array s2 into the character
    array s1. If s2 is shorter than n characters, '\0' bytes will be appended to
@@ -56,7 +56,7 @@ char * strcpy( char * _PDCLIB_restrict s1, const char * _PDCLIB_restrict s2 );
    behaviour is undefined.
    Returns the value of s1.
 */
-char * strncpy( char * _PDCLIB_restrict s1, const char * _PDCLIB_restrict s2, size_t n );
+char * strncpy( char * _PDCLIB_restrict s1, const char * _PDCLIB_restrict s2, size_t n ) _PDCLIB_nothrow;
 
 /* Concatenation functions */
 
@@ -65,7 +65,7 @@ char * strncpy( char * _PDCLIB_restrict s1, const char * _PDCLIB_restrict s2, si
    the arrays overlap, behaviour is undefined.
    Returns the value of s1.
 */
-char * strcat( char * _PDCLIB_restrict s1, const char * _PDCLIB_restrict s2 );
+char * strcat( char * _PDCLIB_restrict s1, const char * _PDCLIB_restrict s2 ) _PDCLIB_nothrow;
 
 /* Append a maximum of n characters from the character array s1 to the character
    array s1 (first character of s2 overwriting the '\0' of s1). A terminating
@@ -73,7 +73,7 @@ char * strcat( char * _PDCLIB_restrict s1, const char * _PDCLIB_restrict s2 );
    written. If the arrays overlap, behaviour is undefined.
    Returns the value of s1.
 */
-char * strncat( char * _PDCLIB_restrict s1, const char * _PDCLIB_restrict s2, size_t n );
+char * strncat( char * _PDCLIB_restrict s1, const char * _PDCLIB_restrict s2, size_t n ) _PDCLIB_nothrow;
 
 /* Comparison functions */
 
@@ -81,13 +81,13 @@ char * strncat( char * _PDCLIB_restrict s1, const char * _PDCLIB_restrict s2, si
    Returns 0 if s1 == s2, a negative number if s1 < s2, and a positive number if
    s1 > s2.
 */
-int memcmp( const void * s1, const void * s2, size_t n );
+int memcmp( const void * s1, const void * s2, size_t n ) _PDCLIB_nothrow;
 
 /* Compare the character arrays s1 and s2.
    Returns 0 if s1 == s2, a negative number if s1 < s2, and a positive number if
    s1 > s2.
 */
-int strcmp( const char * s1, const char * s2 );
+int strcmp( const char * s1, const char * s2 ) _PDCLIB_nothrow;
 
 /* Compare the character arrays s1 and s2, interpreted as specified by the
    LC_COLLATE category of the current locale.
@@ -96,21 +96,21 @@ int strcmp( const char * s1, const char * s2 );
    TODO: Currently a dummy wrapper for strcmp() as PDCLib does not yet support
    locales.
 */
-int strcoll( const char * s1, const char * s2 );
+int strcoll( const char * s1, const char * s2 ) _PDCLIB_nothrow;
 
 /* Compare no more than the first n characters of the character arrays s1 and
    s2.
    Returns 0 if s1 == s2, a negative number if s1 < s2, and a positive number if
    s1 > s2.
 */
-int strncmp( const char * s1, const char * s2, size_t n );
+int strncmp( const char * s1, const char * s2, size_t n ) _PDCLIB_nothrow;
 
 /* Transform the character array s2 as appropriate for the LC_COLLATE setting of
    the current locale. If length of resulting string is less than n, store it in
    the character array pointed to by s1. Return the length of the resulting
    string.
 */
-size_t strxfrm( char * _PDCLIB_restrict s1, const char * _PDCLIB_restrict s2, size_t n );
+size_t strxfrm( char * _PDCLIB_restrict s1, const char * _PDCLIB_restrict s2, size_t n ) _PDCLIB_nothrow;
 
 /* Search functions */
 
@@ -118,42 +118,42 @@ size_t strxfrm( char * _PDCLIB_restrict s1, const char * _PDCLIB_restrict s2, si
    character c (interpreted as unsigned char).
    Returns a pointer to the first instance found, or NULL.
 */
-void * memchr( const void * s, int c, size_t n );
+void * memchr( const void * s, int c, size_t n ) _PDCLIB_nothrow;
 
 /* Search the character array s (including terminating '\0') for the character c
    (interpreted as char).
    Returns a pointer to the first instance found, or NULL.
 */
-char * strchr( const char * s, int c );
+char * strchr( const char * s, int c ) _PDCLIB_nothrow;
 
 /* Determine the length of the initial substring of character array s1 which
    consists only of characters not from the character array s2.
    Returns the length of that substring.
 */
-size_t strcspn( const char * s1, const char * s2 );
+size_t strcspn( const char * s1, const char * s2 ) _PDCLIB_nothrow;
 
 /* Search the character array s1 for any character from the character array s2.
    Returns a pointer to the first occurrence, or NULL.
 */
-char * strpbrk( const char * s1, const char * s2 );
+char * strpbrk( const char * s1, const char * s2 ) _PDCLIB_nothrow;
 
 /* Search the character array s (including terminating '\0') for the character c
    (interpreted as char).
    Returns a pointer to the last instance found, or NULL.
 */
-char * strrchr( const char * s, int c );
+char * strrchr( const char * s, int c ) _PDCLIB_nothrow;
 
 /* Determine the length of the initial substring of character array s1 which
    consists only of characters from the character array s2.
    Returns the length of that substring.
 */
-size_t strspn( const char * s1, const char * s2 );
+size_t strspn( const char * s1, const char * s2 ) _PDCLIB_nothrow;
 
 /* Search the character array s1 for the substring in character array s2.
    Returns a pointer to that sbstring, or NULL. If s2 is of length zero,
    returns s1.
 */
-char * strstr( const char * s1, const char * s2 );
+char * strstr( const char * s1, const char * s2 ) _PDCLIB_nothrow;
 
 /* In a series of subsequent calls, parse a C string into tokens.
    On the first call to strtok(), the first argument is a pointer to the to-be-
@@ -164,7 +164,7 @@ char * strstr( const char * s1, const char * s2 );
    Returns a pointer to the next token.
    WARNING: This function uses static storage, and as such is not reentrant.
 */
-char * strtok( char * _PDCLIB_restrict s1, const char * _PDCLIB_restrict s2 );
+char * strtok( char * _PDCLIB_restrict s1, const char * _PDCLIB_restrict s2 ) _PDCLIB_nothrow;
 
 /* Miscellaneous functions */
 
@@ -172,21 +172,21 @@ char * strtok( char * _PDCLIB_restrict s1, const char * _PDCLIB_restrict s2 );
    characters of the memory area pointed to by s.
    Returns s.
 */
-void * memset( void * s, int c, size_t n );
+void * memset( void * s, int c, size_t n ) _PDCLIB_nothrow;
 
 /* Map an error number to a (locale-specific) error message string. Error
    numbers are typically errno values, but any number is mapped to a message.
    TODO: PDCLib does not yet support locales.
 */
-char * strerror( int errnum );
+char * strerror( int errnum ) _PDCLIB_nothrow;
 
 /* Returns the length of the string s (excluding terminating '\0').
 */
-size_t strlen( const char * s );
+size_t strlen( const char * s ) _PDCLIB_nothrow;
 
 #if _PDCLIB_POSIX_MIN(2008098L) || _PDCLIB_XOPEN_MIN(0)
-char * strdup( const char* src );
-char * strndup( const char* src, size_t n );
+char * strdup( const char* src ) _PDCLIB_nothrow;
+char * strndup( const char* src, size_t n ) _PDCLIB_nothrow;
 #endif
 
 _PDCLIB_END_EXTERN_C
index 5de3d380b6d96b098aa12260ace771f0a96199fb..c9e3b07f24b656a1730f22f7349f3feb656791eb 100644 (file)
@@ -38,24 +38,24 @@ void call_once(once_flag *flag, void (*func)(void))
 \r
 #if defined(_PDCLIB_MTX_T)\r
 typedef _PDCLIB_MTX_T          mtx_t;\r
-void mtx_destroy(mtx_t *mtx);\r
-int mtx_init(mtx_t *mtx, int type);\r
-int mtx_lock(mtx_t *mtx);\r
-int mtx_timedlock(mtx_t *_PDCLIB_restrict mtx, const struct timespec *_PDCLIB_restrict ts);\r
-int mtx_trylock(mtx_t *mtx);\r
-int mtx_unlock(mtx_t *mtx);\r
+void mtx_destroy(mtx_t *mtx) _PDCLIB_nothrow;\r
+int mtx_init(mtx_t *mtx, int type) _PDCLIB_nothrow;\r
+int mtx_lock(mtx_t *mtx) _PDCLIB_nothrow;\r
+int mtx_timedlock(mtx_t *_PDCLIB_restrict mtx, const struct timespec *_PDCLIB_restrict ts) _PDCLIB_nothrow;\r
+int mtx_trylock(mtx_t *mtx) _PDCLIB_nothrow;\r
+int mtx_unlock(mtx_t *mtx) _PDCLIB_nothrow;\r
 #endif\r
 \r
 #if defined(_PDCLIB_CND_T)\r
 typedef _PDCLIB_CND_T          cnd_t;\r
-int cnd_broadcast(cnd_t *cond);\r
-void cnd_destroy(cnd_t *cond);\r
-int cnd_init(cnd_t *cond);\r
-int cnd_signal(cnd_t *cond);\r
+int cnd_broadcast(cnd_t *cond) _PDCLIB_nothrow;\r
+void cnd_destroy(cnd_t *cond) _PDCLIB_nothrow;\r
+int cnd_init(cnd_t *cond) _PDCLIB_nothrow;\r
+int cnd_signal(cnd_t *cond) _PDCLIB_nothrow;\r
 int cnd_timedwait(cnd_t *_PDCLIB_restrict cond,\r
        mtx_t *_PDCLIB_restrict mtx,\r
-       const struct timespec *_PDCLIB_restrict ts);\r
-int cnd_wait(cnd_t *cond, mtx_t *mtx);\r
+       const struct timespec *_PDCLIB_restrict ts) _PDCLIB_nothrow;\r
+int cnd_wait(cnd_t *cond, mtx_t *mtx) _PDCLIB_nothrow;\r
 #endif\r
 \r
 #if defined(_PDCLIB_THRD_T)\r
@@ -63,17 +63,20 @@ int cnd_wait(cnd_t *cond, mtx_t *mtx);
 typedef _PDCLIB_THRD_T         thrd_t;\r
 typedef int (*)(void*)  thrd_start_t;\r
 \r
-int thrd_create(thrd_t *thr, thrd_start_t func, void *arg);\r
-thrd_t thrd_current(void);\r
-int thrd_detach(thrd_t thr);\r
-int thrd_equal(thrd_t thr0, thrd_t thr1);\r
+int thrd_create(thrd_t *thr, thrd_start_t func, void *arg) _PDCLIB_nothrow;\r
+thrd_t thrd_current(void) _PDCLIB_nothrow;\r
+int thrd_detach(thrd_t thr) _PDCLIB_nothrow;\r
+int thrd_equal(thrd_t thr0, thrd_t thr1) _PDCLIB_nothrow;\r
+\r
+/* Not nothrow: systems may use exceptions at thread exit */\r
 _PDCLIB_noreturn void thrd_exit(int res);\r
+/* Not nothrow: systems may potentially propogate exceptions out of thrd_join?*/\r
 int thrd_join(thrd_t thr, int *res);\r
 #endif\r
 \r
 #if defined(_PDCLIB_THRD_HAVE_MISC)\r
-int thrd_sleep(const struct timespec *duration, struct timespec *remaining);\r
-void thrd_yield(void);\r
+int thrd_sleep(const struct timespec *duration, struct timespec *remaining) _PDCLIB_nothrow;\r
+void thrd_yield(void) _PDCLIB_nothrow;\r
 #endif\r
 \r
 /* The behaviour of tss_t is woefully underspecified in the C11 standard. In \r
@@ -88,10 +91,10 @@ void thrd_yield(void);
 typedef _PDCLIB_TSS_T          tss_t;\r
 typedef void (*tss_dtor_t)(void*);\r
 \r
-int tss_create(tss_t *key, tss_dtor_t dtor);\r
-void tss_delete(tss_t key);\r
-void *tss_get(tss_t key);\r
-int tss_set(tss_t key, void *val);\r
+int tss_create(tss_t *key, tss_dtor_t dtor) _PDCLIB_nothrow;\r
+void tss_delete(tss_t key) _PDCLIB_nothrow;\r
+void *tss_get(tss_t key) _PDCLIB_nothrow;\r
+int tss_set(tss_t key, void *val) _PDCLIB_nothrow;\r
 #endif\r
 \r
 _PDCLIB_END_EXTERN_C\r
index 784685d0d037fb24dc59f28d7683e50d0fcb8915..57db23032f381d11bdaf4e0045466d2aba9bfa70 100644 (file)
@@ -27,7 +27,7 @@ _PDCLIB_DEFINE_STRUCT_TIMESPEC()
 _PDCLIB_DEFINE_STRUCT_TM()\r
 #endif\r
 \r
-time_t time(time_t* t);\r
+time_t time(time_t* t) _PDCLIB_nothrow;\r
 \r
 _PDCLIB_END_EXTERN_C\r
 #endif\r
index eab2984b0e297539c88f1c87d59a1664339d11b0..59955b3d80b7a3cb5fa0d6d72123d8d9ecc4cf50 100644 (file)
@@ -25,11 +25,11 @@ typedef _PDCLIB_wchar_t   wchar_t;
 #endif\r
 #endif\r
 \r
-wchar_t *wcschr( const wchar_t * haystack, wchar_t needle );\r
-wchar_t *wcsrchr( const wchar_t * haystack, wchar_t needle );\r
-size_t   wcslen( const wchar_t * string);\r
+wchar_t *wcschr( const wchar_t * haystack, wchar_t needle ) _PDCLIB_nothrow;\r
+wchar_t *wcsrchr( const wchar_t * haystack, wchar_t needle ) _PDCLIB_nothrow;\r
+size_t   wcslen( const wchar_t * string) _PDCLIB_nothrow;\r
 wchar_t *wcscpy( wchar_t * _PDCLIB_restrict dest, \r
-                 const wchar_t * _PDCLIB_restrict src);\r
+                 const wchar_t * _PDCLIB_restrict src) _PDCLIB_nothrow;\r
 \r
 _PDCLIB_END_EXTERN_C\r
 #endif\r
index e7e908a66e413d70cee645fc2ad26b8e0749049d..5183c9fdc3c08d6ef7759097178391d555b96dac 100644 (file)
        #define _PDCLIB_inline   inline
 #endif
 
+#if _PDCLIB_CXX_VERSION >= 2011
+  #define _PDCLIB_nothrow     noexcept
+  #define _PDCLIB_noexcept(x) noexcept(x)
+#elif _PDCLIB_CXX_VERSION
+  #define _PDCLIB_nothrow     throw()
+  #define _PDCLIB_noexcept
+#endif
+
 #if _PDCLIB_CXX_VERSION >= 2011
   // Hold off on C++ attribute syntax for now
   // #define _PDCLIB_noreturn [[noreturn]]
@@ -71,9 +79,9 @@
 #endif
 
 #ifdef __GNUC__
-       #ifndef _PDCLIB_EXPORT
-               #define _PDCLIB_EXPORT __attribute__((__visibility__("protected")))
-       #endif
+         #ifndef _PDCLIB_EXPORT
+           #define _PDCLIB_EXPORT __attribute__((__visibility__("protected")))
+    #endif
 
        #ifndef _PDCLIB_IMPORT
                #define _PDCLIB_IMPORT
                #define _PDCLIB_HIDDEN __attribute__((__visibility__("hidden")))
        #endif
 
+    #ifndef _PDCLIB_nothrow
+      #define _PDCLIB_nothrow __attribute__((__nothrow__))
+      #define _PDCLIB_noexcept
+    #endif
+
        #ifndef _PDCLIB_restrict
                #define _PDCLIB_restrict __restrict
        #endif
        #endif
 #endif
 
+#ifndef _PDCLIB_nothrow
+  #define _PDCLIB_nothrow
+  #define _PDCLIB_noexcept
+#endif
+
 #ifndef _PDCLIB_EXPORT
        #define _PDCLIB_EXPORT
 #endif
     #endif
 #endif
 
-#endif
\ No newline at end of file
+#endif
index 4477fc1ddb479333fc693001b3ae3a85937b3b26..af4c03377028477f9213a0bd36abf535acc01ad8 100644 (file)
@@ -441,7 +441,7 @@ extern int _PDCLIB_errno;
 /* A mechanism for delayed evaluation. (Not sure if this is really necessary, so
    no detailed documentation on the "why".)
 */
-int * _PDCLIB_errno_func( void );
+int * _PDCLIB_errno_func( void ) _PDCLIB_nothrow;
 
 /* -------------------------------------------------------------------------- */
 /* <ctype.h> lookup tables                                                    */