diff options
-rw-r--r-- | Makefile | 10 | ||||
-rw-r--r-- | include/assert.h | 2 | ||||
-rw-r--r-- | include/ctype.h | 22 | ||||
-rw-r--r-- | src/errno.c | 1 | ||||
-rw-r--r-- | src/libgen.c | 7 | ||||
-rw-r--r-- | src/wchar/wcsdup.c | 1 |
6 files changed, 27 insertions, 16 deletions
@@ -25,7 +25,7 @@ CCFLAGS_SLIBC_DEFS = -D_SLIBC_SOURCE=1 -D_GNU_SOURCE=1 -D_BSD_SOURCE=1 -D_SLIBC_ -D_POSIX_C_SOURCE=999999L -D_XOPEN_SOURCE=9999 # Flag that specifies which C dialect the library is written. -CCFLAGS_CSTD = -std=gnu11 +CCFLAGS_CSTD = -std=c11 # Flags that specify where the system header files (that would in this case # be this library's header files) are located. @@ -61,6 +61,12 @@ MMFLAGS = $(CCFLAGS_COMMON) -MG # Object files to build. OBJECTS = $(shell find src | grep '\.c$$' | sed -e 's:^src/:obj/:' -e 's:\.c$$:\.o:') +# All header files. +HEADERS = $(shell find . | grep '\.h$$' | sed -e 's:^\./::') + +# All code files. +SOURCES = $(shell find src | grep '\.c$$') + # You may add config.mk to the topmost directory @@ -93,7 +99,7 @@ obj/%.o: # Generate list of file dependencies for object files. -obj/deps.mk: Makefile +obj/deps.mk: Makefile $(HEADERS) $(SOURCES) @mkdir -p obj find src | grep '\.c$$' | xargs $(CC) -MM $(MMFLAGS) > $@ sed -i 's#^[^ :]*\.o: src\([^ ]*\)/[^ /]*\.c#obj\1/&#' $@ diff --git a/include/assert.h b/include/assert.h index 838a9bf..dad6042 100644 --- a/include/assert.h +++ b/include/assert.h @@ -88,7 +88,7 @@ * @param func The function in the source code whence the assertion was made */ void __assert_fail(const char*, int, const char*, int, const char*) - __noreturn __GCC_ONLY(__attribute__((nonnull(3, 4, 5)))); + __GCC_ONLY(__attribute__((nonnull(3, 5)))) __noreturn; diff --git a/include/ctype.h b/include/ctype.h index f98705d..d788c10 100644 --- a/include/ctype.h +++ b/include/ctype.h @@ -52,7 +52,7 @@ int (isalnum)(int) /* [0x30, 0x39], [0x41, 0x5A], [0x61, 0x7A] */ */ int (isalpha)(int) /* [0x41, 0x5A], [0x61, 0x7A] */ __GCC_ONLY(__attribute__((const))); -#define isalpha(c) (islower(tolower(a))) +#define isalpha(c) (islower(tolower(c))) #ifdef _GNU_SOURCE @@ -86,7 +86,7 @@ int (iscntrl)(int) /* [0x00, 0x1F], 0x7F */ __GCC_ONLY(__attribute__((const))); #if defined(__GNUC__) # define iscntrl(c) \ - ({ int __c = (c); (((unsigned)__c < ' ') || (c__ == 0x7F)); }) + ({ int __c = (c); (((unsigned)__c < ' ') || (__c == 0x7F)); }) #endif @@ -98,7 +98,7 @@ int (iscntrl)(int) /* [0x00, 0x1F], 0x7F */ */ int (isdigit)(int) /* [0x30, 0x39] */ __GCC_ONLY(__attribute__((const))); -#define isdigit(c) ((unsigned)((c) - '0') < 10) +#define isdigit(c) (int)((unsigned)((c) - '0') < 10) /** @@ -110,7 +110,7 @@ int (isdigit)(int) /* [0x30, 0x39] */ */ int (isgraph)(int) /* [0x21, 0x7E] */ __GCC_ONLY(__attribute__((const))); -#define isgraph(c) ((unsigned)(c - 0x21) < 0x5E) +#define isgraph(c) (int)((unsigned)(c - 0x21) < 0x5E) /** @@ -122,7 +122,7 @@ int (isgraph)(int) /* [0x21, 0x7E] */ */ int (islower)(int) /* [0x61, 0x7A] */ __GCC_ONLY(__attribute__((const))); -#define islower(c) ((unsigned)((c) - 'a') < 26) +#define islower(c) (int)((unsigned)((c) - 'a') < 26) /** @@ -135,7 +135,7 @@ int (islower)(int) /* [0x61, 0x7A] */ */ int (isprint)(int) /* [0x20, 0x7E] */ __GCC_ONLY(__attribute__((const))); -#define isprint(c) ((unsigned)(c - 0x20) < 0x5F) +#define isprint(c) (int)((unsigned)(c - 0x20) < 0x5F) /** @@ -178,7 +178,7 @@ int (isspace)(int) /* 0x20, [0x09, 0x0D] */ */ int (isupper)(int) /* [0x41, 0x5A] */ __GCC_ONLY(__attribute__((const))); -#define isupper(c) ((unsigned)((c) - 'A') < 26) +#define isupper(c) (int)((unsigned)((c) - 'A') < 26) /** @@ -215,7 +215,7 @@ int (isxdigit)(int) /* [0x30, 0x39], [0x41, 0x46], [0x61, 0x66] */ */ int (tolower)(int) /* [0x41, 0x5A] -> [0x61, 0x7A] */ __GCC_ONLY(__attribute__((const))); -#define tolower(c) ((unsigned)(c) | 0x20) +#define tolower(c) (int)((unsigned)(c) | 0x20) /** * Convert a lowercase ASCII character to @@ -233,7 +233,7 @@ int (tolower)(int) /* [0x41, 0x5A] -> [0x61, 0x7A] */ */ int (toupper)(int) /* [0x61, 0x7A] -> [0x41, 0x5A] */ __GCC_ONLY(__attribute__((const))); -#define toupper(c) ((unsigned)(c) & ~0x20) +#define toupper(c) (int)((unsigned)(c) & (unsigned)~0x20) @@ -245,7 +245,7 @@ int (toupper)(int) /* [0x61, 0x7A] -> [0x41, 0x5A] */ */ int (isascii)(int) /* [0x00, 0x7E] */ __GCC_ONLY(__attribute__((const))); -#define isascii(c) ((unsigned)(c) < 0x7F) +#define isascii(c) (int)((unsigned)(c) < 0x7F) /** * Remove the 8:th bit from a character. @@ -260,7 +260,7 @@ int (toascii)(int) __warning("Using 'toascii' is, generally, unwise.") __GCC_ONLY(__attribute__((const))); #if defined(_SLIBC_SUPPRESS_WARNINGS) -# define toascii(c) ((unsigned)(c) & 0x7F) +# define toascii(c) (int)((unsigned)(c) & 0x7F) #endif /** diff --git a/src/errno.c b/src/errno.c index 80b46fe..aae7513 100644 --- a/src/errno.c +++ b/src/errno.c @@ -16,6 +16,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <errno.h> +#include <stddef.h> diff --git a/src/libgen.c b/src/libgen.c index f8c338b..8ab303e 100644 --- a/src/libgen.c +++ b/src/libgen.c @@ -20,6 +20,9 @@ #include <stddef.h> +# pragma GCC diagnostic ignored "-Wdiscarded-qualifiers" + + /** * Get the basename of a filename. @@ -63,9 +66,9 @@ char* __xpg_basename(char* filename) { char* r = __gnu_basename(filename); char* p; - if (strcmp(".")) + if (strcmp(r, ".")) for (p = r + 1; *p; p++) - if (p == '/') + if (*p == '/') *p = 0; return r; } diff --git a/src/wchar/wcsdup.c b/src/wchar/wcsdup.c index 37b57f9..fa68834 100644 --- a/src/wchar/wcsdup.c +++ b/src/wchar/wcsdup.c @@ -16,6 +16,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <wchar.h> +#include <stdlib.h> |