enabled and fixed -Wshadow and -Wuseless-cast offences
This commit is contained in:
parent
6d73e7898e
commit
73eb7856dd
@ -45,8 +45,8 @@ buildir := $(realpath .)/build
|
|||||||
binsubdir := $(platform)-$(architecture)
|
binsubdir := $(platform)-$(architecture)
|
||||||
bindir := $(prefix)/bin/$(binsubdir)
|
bindir := $(prefix)/bin/$(binsubdir)
|
||||||
|
|
||||||
CFLAGS := -O2 -g -Wall -pedantic -Werror -std=c99
|
CFLAGS := -O2 -g -Wall -pedantic -Werror -Wshadow -std=c99
|
||||||
CXXFLAGS := -O2 -g -Wall -pedantic -Werror
|
CXXFLAGS := -O2 -g -Wall -pedantic -Werror -Wshadow -Wuseless-cast
|
||||||
|
|
||||||
ifeq ($(platform),linux)
|
ifeq ($(platform),linux)
|
||||||
LDFLAGS += -ldl
|
LDFLAGS += -ldl
|
||||||
|
@ -129,15 +129,13 @@ static int WAI_PREFIX(getModulePath_)(HMODULE module, char* out, int capacity, i
|
|||||||
return length;
|
return length;
|
||||||
}
|
}
|
||||||
|
|
||||||
WAI_NOINLINE
|
WAI_NOINLINE WAI_FUNCSPEC
|
||||||
WAI_FUNCSPEC
|
|
||||||
int WAI_PREFIX(getExecutablePath)(char* out, int capacity, int* dirname_length)
|
int WAI_PREFIX(getExecutablePath)(char* out, int capacity, int* dirname_length)
|
||||||
{
|
{
|
||||||
return WAI_PREFIX(getModulePath_)(NULL, out, capacity, dirname_length);
|
return WAI_PREFIX(getModulePath_)(NULL, out, capacity, dirname_length);
|
||||||
}
|
}
|
||||||
|
|
||||||
WAI_NOINLINE
|
WAI_NOINLINE WAI_FUNCSPEC
|
||||||
WAI_FUNCSPEC
|
|
||||||
int WAI_PREFIX(getModulePath)(char* out, int capacity, int* dirname_length)
|
int WAI_PREFIX(getModulePath)(char* out, int capacity, int* dirname_length)
|
||||||
{
|
{
|
||||||
HMODULE module;
|
HMODULE module;
|
||||||
@ -238,15 +236,13 @@ int WAI_PREFIX(getExecutablePath)(char* out, int capacity, int* dirname_length)
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
WAI_NOINLINE
|
WAI_NOINLINE WAI_FUNCSPEC
|
||||||
WAI_FUNCSPEC
|
|
||||||
int WAI_PREFIX(getModulePath)(char* out, int capacity, int* dirname_length)
|
int WAI_PREFIX(getModulePath)(char* out, int capacity, int* dirname_length)
|
||||||
{
|
{
|
||||||
int length = -1;
|
int length = -1;
|
||||||
FILE* maps = NULL;
|
FILE* maps = NULL;
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; i < WAI_PROC_SELF_MAPS_RETRY; ++i)
|
for (int r = 0; r < WAI_PROC_SELF_MAPS_RETRY; ++r)
|
||||||
{
|
{
|
||||||
maps = fopen(WAI_PROC_SELF_MAPS, "r");
|
maps = fopen(WAI_PROC_SELF_MAPS, "r");
|
||||||
if (!maps)
|
if (!maps)
|
||||||
@ -267,7 +263,7 @@ int WAI_PREFIX(getModulePath)(char* out, int capacity, int* dirname_length)
|
|||||||
|
|
||||||
if (sscanf(buffer, "%" PRIx64 "-%" PRIx64 " %s %" PRIx64 " %x:%x %u %s\n", &low, &high, perms, &offset, &major, &minor, &inode, path) == 8)
|
if (sscanf(buffer, "%" PRIx64 "-%" PRIx64 " %s %" PRIx64 " %x:%x %u %s\n", &low, &high, perms, &offset, &major, &minor, &inode, path) == 8)
|
||||||
{
|
{
|
||||||
uint64_t addr = (uint64_t)(uintptr_t)WAI_RETURN_ADDRESS();
|
uint64_t addr = (uintptr_t)WAI_RETURN_ADDRESS();
|
||||||
if (low <= addr && addr <= high)
|
if (low <= addr && addr <= high)
|
||||||
{
|
{
|
||||||
char* resolved;
|
char* resolved;
|
||||||
@ -339,11 +335,15 @@ int WAI_PREFIX(getModulePath)(char* out, int capacity, int* dirname_length)
|
|||||||
}
|
}
|
||||||
|
|
||||||
fclose(maps);
|
fclose(maps);
|
||||||
|
maps = NULL;
|
||||||
|
|
||||||
if (length != -1)
|
if (length != -1)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (maps)
|
||||||
|
fclose(maps);
|
||||||
|
|
||||||
return length;
|
return length;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -408,8 +408,7 @@ int WAI_PREFIX(getExecutablePath)(char* out, int capacity, int* dirname_length)
|
|||||||
return length;
|
return length;
|
||||||
}
|
}
|
||||||
|
|
||||||
WAI_NOINLINE
|
WAI_NOINLINE WAI_FUNCSPEC
|
||||||
WAI_FUNCSPEC
|
|
||||||
int WAI_PREFIX(getModulePath)(char* out, int capacity, int* dirname_length)
|
int WAI_PREFIX(getModulePath)(char* out, int capacity, int* dirname_length)
|
||||||
{
|
{
|
||||||
char buffer[PATH_MAX];
|
char buffer[PATH_MAX];
|
||||||
@ -619,8 +618,7 @@ int WAI_PREFIX(getExecutablePath)(char* out, int capacity, int* dirname_length)
|
|||||||
return length;
|
return length;
|
||||||
}
|
}
|
||||||
|
|
||||||
WAI_NOINLINE
|
WAI_NOINLINE WAI_FUNCSPEC
|
||||||
WAI_FUNCSPEC
|
|
||||||
int WAI_PREFIX(getModulePath)(char* out, int capacity, int* dirname_length)
|
int WAI_PREFIX(getModulePath)(char* out, int capacity, int* dirname_length)
|
||||||
{
|
{
|
||||||
char buffer[PATH_MAX];
|
char buffer[PATH_MAX];
|
||||||
|
Loading…
Reference in New Issue
Block a user