Browse Source

Brought up to -w flag spec

master
dirkson 3 years ago
parent
commit
6b5fea0096
  1. 1
      meson.build
  2. 2
      src/dynload.c
  3. 32
      src/gen/gen.c

1
meson.build

@ -1,4 +1,5 @@
project('dynload', 'c', default_options : ['default_library=static', 'c_std=c99'])
add_project_arguments(['-Werror', '-Wall', '-Wpedantic', '-Wextra'], language : 'c')
incdir = include_directories('include')
if get_option('buildtype').startswith('debug')

2
src/dynload.c

@ -45,7 +45,7 @@
void dynload_attempt_open(dynload_library* lib)
{
int i;
unsigned int i;
for(i = 0; i < lib->dynobj_num; i++)
{
#ifdef DYNLOAD_DEBUG

32
src/gen/gen.c

@ -81,7 +81,6 @@ char* dynloadgen_uppercase(char *str)
int dynloadgen_write_header(gendata_t *gendata)
{
int i, j;
char Tempstr[256];
snprintf(Tempstr, 256, "genheaders/dynload_%s.h", gendata->name);
FILE* file = fopen(Tempstr, "w");
@ -101,7 +100,7 @@ int dynloadgen_write_header(gendata_t *gendata)
char* simpleHeaderPre;
char* simpleHeader;
for (i = 0; i < gendata->header_num; i++)
for (int i = 0; i < gendata->header_num; i++)
{
simpleHeaderPre = strstr(gendata->header[i].name, "/include")+1; //+1 skips the first /
if (simpleHeaderPre != NULL)
@ -112,9 +111,9 @@ int dynloadgen_write_header(gendata_t *gendata)
fprintf(file, "#include <%s>\n", simpleHeader);
}
for (i = 0; i < gendata->header_num; i++)
for (int i = 0; i < gendata->header_num; i++)
{
for (j = 0; j < gendata->header[i].symbol_num; j++)
for (int j = 0; j < gendata->header[i].symbol_num; j++)
{
if (gendata->header[i].symbol_def_pre[j] != NULL) //Don't provide macros if we couldn't find it
{
@ -139,9 +138,9 @@ int dynloadgen_write_header(gendata_t *gendata)
fprintf(file, "char* dynload_%s_symbol_names[DYNLOAD_%s_SYMBOL_NUM] = { ", gendata->name, upperName);
for (i = 0; i < gendata->header_num; i++)
for (int i = 0; i < gendata->header_num; i++)
{
for (j = 0; j < gendata->header[i].symbol_num; j++)
for (int j = 0; j < gendata->header[i].symbol_num; j++)
{
fprintf(file, "\"%s\", ", gendata->header[i].symbol_def_symbol[j]);
}
@ -151,7 +150,7 @@ int dynloadgen_write_header(gendata_t *gendata)
fprintf(file, "void* dynload_%s_symbol_pointers[DYNLOAD_%s_SYMBOL_NUM];\n", gendata->name, upperName);
fprintf(file, "char* dynload_%s_dynobj[DYNLOAD_%s_DYNOBJ_NUM] = { ", gendata->name, upperName);
for (i = 0; i < gendata->lib.dynobj_num; i++)
for (unsigned int i = 0; i < gendata->lib.dynobj_num; i++)
{
fprintf(file, "\"%s\", ", gendata->lib.dynobj[i]);
}
@ -187,10 +186,9 @@ int dynloadgen_write_cfile(gendata_t *gendata)
fprintf(file, "#define DYNLOAD_%s_DYNOBJ_NUM %i\n", upperName, gendata->lib.dynobj_num);
fprintf(file, "char* dynload_%s_symbol_names[DYNLOAD_%s_SYMBOL_NUM] = { ", gendata->name, upperName);
int i, j;
for (i = 0; i < gendata->header_num; i++)
for (int i = 0; i < gendata->header_num; i++)
{
for (j = 0; j < gendata->header[i].symbol_num; j++)
for (int j = 0; j < gendata->header[i].symbol_num; j++)
{
fprintf(file, "\"%s\", ", gendata->header[i].symbol_def_symbol[j]);
}
@ -200,7 +198,7 @@ int dynloadgen_write_cfile(gendata_t *gendata)
fprintf(file, "void* dynload_%s_symbol_pointers[DYNLOAD_%s_SYMBOL_NUM];\n", gendata->name, upperName);
fprintf(file, "char* dynload_%s_dynobj[DYNLOAD_%s_SYMBOL_NUM] = { ", gendata->name, upperName);
for (i = 0; i < gendata->lib.dynobj_num; i++)
for (unsigned int i = 0; i < gendata->lib.dynobj_num; i++)
{
fprintf(file, "\"%s\", ", gendata->lib.dynobj[i]);
}
@ -513,6 +511,10 @@ int dynloadgen_i_to_j(gendata_t* gendata)
int dynloadgen_create_directory(gendata_t *gendata)
{
//Intentionall mark as unused
(void)(gendata);
char dir[128];
snprintf(dir, 128, "genheaders");
//Trying to figure out if this thing fails is complicated. For the moment, we'll just assume it works.
@ -776,7 +778,13 @@ int dynloadgen_process_gen(char* GenFilename)
{
printf("Attempting to generate: %s \n", GenFilename);
int ReturnValue = EXIT_FAILURE;
gendata_t gendata = { NULL };
gendata_t gendata = {
.name = NULL,
.preprocessor = NULL,
.header = NULL,
.header_num = 0,
//.lib; //Contains filename, function names, etc.
};
//Weird switch statement allows us to 'break' when failure happens
switch (1) {
default:

Loading…
Cancel
Save