mirror of
https://github.com/DarkPlacesEngine/gmqcc.git
synced 2025-01-31 03:50:36 +00:00
Fix clang warnings
This commit is contained in:
parent
2bef34a4f7
commit
32b804864e
5 changed files with 11 additions and 10 deletions
2
Makefile
2
Makefile
|
@ -1,4 +1,4 @@
|
|||
CC = gcc
|
||||
CC = clang
|
||||
CFLAGS += -Wall
|
||||
OBJ = main.o \
|
||||
lex.o \
|
||||
|
|
2
gmqcc.h
2
gmqcc.h
|
@ -67,7 +67,7 @@ typedef char int16_size_if_correct [sizeof(int16_t) == 2?1:-1];
|
|||
typedef char int32_size_is_correct [sizeof(int32_t) == 4?1:-1];
|
||||
/* intptr_t / uintptr_t correct size check */
|
||||
typedef char uintptr_size_is_correct[sizeof(intptr_t) == sizeof(int*)?1:-1];
|
||||
typedef char uintptr_size_is_correct[sizeof(uintptr_t)== sizeof(int*)?1:-1];
|
||||
typedef char intptr_size_is_correct [sizeof(uintptr_t)== sizeof(int*)?1:-1];
|
||||
|
||||
//===================================================================
|
||||
//============================ lex.c ================================
|
||||
|
|
2
lex.c
2
lex.c
|
@ -293,7 +293,7 @@ int lex_token(struct lex_file *file) {
|
|||
|
||||
/* look inside the table for a keyword .. */
|
||||
for (it = 0; it < sizeof(lex_keywords)/sizeof(*lex_keywords); it++)
|
||||
if (!strncmp(file->lastok, lex_keywords[it], sizeof(lex_keywords[it])))
|
||||
if (!strncmp(file->lastok, lex_keywords[it], strlen(lex_keywords[it])))
|
||||
return it;
|
||||
|
||||
/* try a type? */
|
||||
|
|
2
parse.c
2
parse.c
|
@ -293,7 +293,7 @@ int parse_gen(struct lex_file *file) {
|
|||
lex_reset(file);
|
||||
/* free constants */
|
||||
{
|
||||
size_t i;
|
||||
size_t i = 0;
|
||||
for (; i < compile_constants_elements; i++) {
|
||||
mem_d(compile_constants_data[i].name);
|
||||
mem_d(compile_constants_data[i].string);
|
||||
|
|
13
util.c
13
util.c
|
@ -43,7 +43,7 @@ void *util_memory_a(unsigned int byte, unsigned int line, const char *file) {
|
|||
info->byte = byte;
|
||||
info->file = file;
|
||||
|
||||
util_debug("MEM", "allocation: %08u (bytes) address 0x%08X @ %s:%u\n", byte, data, file, line);
|
||||
util_debug("MEM", "allocation: % 8u (bytes) address 0x%08X @ %s:%u\n", byte, data, file, line);
|
||||
mem_at++;
|
||||
mem_ab += info->byte;
|
||||
return data;
|
||||
|
@ -54,7 +54,7 @@ void util_memory_d(void *ptrn, unsigned int line, const char *file) {
|
|||
void *data = (void*)((uintptr_t)ptrn-sizeof(struct memblock_t));
|
||||
struct memblock_t *info = (struct memblock_t*)data;
|
||||
|
||||
util_debug("MEM", "released: %08u (bytes) address 0x%08X @ %s:%u\n", info->byte, data, file, line);
|
||||
util_debug("MEM", "released: % 8u (bytes) address 0x%08X @ %s:%u\n", info->byte, data, file, line);
|
||||
mem_db += info->byte;
|
||||
mem_dt++;
|
||||
free(data);
|
||||
|
@ -142,7 +142,7 @@ void util_debug(const char *area, const char *ms, ...) {
|
|||
va_start(va, ms);
|
||||
fprintf (stdout, "DEBUG: ");
|
||||
fputc ('[', stdout);
|
||||
fprintf (stdout, area);
|
||||
fprintf(stdout, "%s",area);
|
||||
fputs ("] ", stdout);
|
||||
vfprintf(stdout, ms, va);
|
||||
va_end (va);
|
||||
|
@ -177,13 +177,14 @@ int util_getline(char **lineptr, size_t *n, FILE *stream) {
|
|||
|
||||
chr = *n + *lineptr - pos;
|
||||
strcpy(tmp,*lineptr);
|
||||
if (!(*lineptr = tmp))
|
||||
if (!(*lineptr = tmp)) {
|
||||
mem_d (tmp);
|
||||
return -1;
|
||||
|
||||
}
|
||||
pos = *n - chr + *lineptr;
|
||||
}
|
||||
|
||||
if (ferror(stream))
|
||||
if (ferror(stream))
|
||||
return -1;
|
||||
if (c == EOF) {
|
||||
if (pos == *lineptr)
|
||||
|
|
Loading…
Reference in a new issue