Commit fb545b33 authored by Hans-Nikolai Viessmann's avatar Hans-Nikolai Viessmann
Browse files

Merge branch 'gcc8-warning-fixes' into 'develop'

GCC 8 warning fixes [unsure]

See merge request !46
parents a38b6ad9 cfb15bf7
......@@ -59,15 +59,16 @@ MakePrec (assoc_t assoc, int val)
/******************************************************************************
*
* function:
* prec_t *FreePrec( prec_t * prec)
* prec_t *FreePrecInLUT( prec_t * prec, void * ignored)
*
* description:
* ...
* Free PREC structure via LUTmap* functions - second argument is unused
* but obligatory with LUTmap* function.
*
******************************************************************************/
static prec_t *
FreePrec (prec_t *prec)
FreePrecInLUT (prec_t *prec, void *ignored)
{
DBUG_ENTER ();
......@@ -308,7 +309,7 @@ HMdoHandleMops (node *arg_node)
arg_node = TRAVdo (arg_node, NULL);
TRAVpop ();
prec_lut = LUTmapLutS (prec_lut, (void *(*)(void *, void *))FreePrec);
prec_lut = LUTmapLutS (prec_lut, (void *(*)(void *, void *))FreePrecInLUT);
prec_lut = LUTremoveLut (prec_lut);
DBUG_RETURN (arg_node);
......
......@@ -472,7 +472,7 @@ MODMgetDeSerializeFunction (const char *name, module_t *module)
result.v = LIBMgetLibraryFunction (name, module->lib);
DBUG_RETURN ((serfun_p)result.f);
DBUG_RETURN (result.f);
}
#undef DBUG_PREFIX
......@@ -69,16 +69,19 @@ char *
CVfloatvec2String (floatvec val)
{
char *s;
int len;
const unsigned vec_len = sizeof (floatvec) / sizeof (float);
const unsigned mem
= 270 * vec_len + vec_len * strlen (", ") + strlen ("(floatvec){}");
const unsigned buf_size = sizeof(char) * mem;
s = (char *)MEMmalloc (sizeof (char) * mem);
sprintf (s, "(floatvec){");
s = (char *)MEMmalloc (buf_size);
len = snprintf (s, buf_size, "(floatvec){");
for (unsigned i = 0; i < vec_len; i++) {
char *t = CVfloat2String (FLOATVEC_IDX (val, i));
sprintf (s, "%s%s%s", s, t, i == vec_len - 1 ? "}" : ", ");
/* offset by len to append to string s */
len += snprintf (s+len, buf_size - len, "%s%s", t, i == vec_len - 1 ? "}" : ", ");
MEMfree (t);
}
......
......@@ -2386,11 +2386,13 @@ PRTfundef (node *arg_node, info *arg_info)
node *
PRTannotate (node *arg_node, info *arg_info)
{
static char strbuffer1[256];
static char strbuffer2[512];
str_buf *buf1, *buf2;
DBUG_ENTER ();
buf1 = SBUFcreate (512);
buf2 = SBUFcreate (512);
DBUG_PRINT ("%s " F_PTR, NODE_TEXT (arg_node), (void *)arg_node);
if (NODE_ERROR (arg_node) != NULL) {
......@@ -2398,11 +2400,11 @@ PRTannotate (node *arg_node, info *arg_info)
}
if (ANNOTATE_TAG (arg_node) & CALL_FUN) {
sprintf (strbuffer1, "PROFILE_BEGIN_UDF( %d, %d)", ANNOTATE_FUNNUMBER (arg_node),
SBUFprintf (buf1, "PROFILE_BEGIN_UDF( %d, %d)", ANNOTATE_FUNNUMBER (arg_node),
ANNOTATE_FUNAPNUMBER (arg_node));
} else {
if (ANNOTATE_TAG (arg_node) & RETURN_FROM_FUN) {
sprintf (strbuffer1, "PROFILE_END_UDF( %d, %d)",
SBUFprintf (buf1, "PROFILE_END_UDF( %d, %d)",
ANNOTATE_FUNNUMBER (arg_node), ANNOTATE_FUNAPNUMBER (arg_node));
} else {
DBUG_UNREACHABLE ("wrong tag at N_annotate");
......@@ -2410,22 +2412,25 @@ PRTannotate (node *arg_node, info *arg_info)
}
if (ANNOTATE_TAG (arg_node) & INL_FUN) {
sprintf (strbuffer2, "PROFILE_INLINE( %s)", strbuffer1);
SBUFprintf (buf2, "PROFILE_INLINE( %s)", SBUFgetBuffer (buf1));
if (ANNOTATE_TAG (arg_node) & LIB_FUN) {
sprintf (strbuffer1, "PROFILE_LIBRARY( %s)", strbuffer2);
SBUFprintf (buf1, "PROFILE_LIBRARY( %s)", SBUFgetBuffer (buf2));
} else {
sprintf (strbuffer1, "%s", strbuffer2);
SBUFprintf (buf1, "%s", SBUFgetBuffer (buf2));
}
} else {
sprintf (strbuffer2, "%s", strbuffer1);
SBUFprintf (buf2, "%s", SBUFgetBuffer (buf1));
if (ANNOTATE_TAG (arg_node) & LIB_FUN) {
sprintf (strbuffer1, "PROFILE_LIBRARY( %s)", strbuffer2);
SBUFprintf (buf1, "PROFILE_LIBRARY( %s)", SBUFgetBuffer (buf2));
} else {
sprintf (strbuffer1, "%s", strbuffer2);
SBUFprintf (buf1, "%s", SBUFgetBuffer (buf2));
}
}
fprintf (global.outfile, "%s;", strbuffer1);
fprintf (global.outfile, "%s;", SBUFgetBuffer (buf1));
buf1 = SBUFfree (buf1);
buf2 = SBUFfree (buf2);
DBUG_RETURN (arg_node);
}
......
......@@ -659,7 +659,7 @@ AddEntryToAst (stentry_t *entry, stentrytype_t type, module_t *module)
"module is inconsistent. cannot find function referenced in"
"symbol table");
entryp = serfun (DSstate);
entryp = serfun ();
/* add to ast */
InsertIntoState (entryp, module);
......@@ -742,7 +742,7 @@ AddSymbolById (const char *symbid, const char *module, bool resetimport)
DBUG_ASSERT (fun != NULL, "requested symbol does not exist!");
entryp = ((serfun0_p)fun) ();
entryp = fun ();
/* add to ast */
InsertIntoState (entryp, mod);
......@@ -820,7 +820,7 @@ DSimportInstancesByName (const char *name, const char *module)
* even imported.
*/
entryp = serfun (DSstate);
entryp = serfun ();
/*
* free object wrappers: a wrapper may point to object wrappers which
......@@ -1023,7 +1023,7 @@ DSloadFunctionBody (node *fundef)
"deserializer not found. module seems to be inconsistent!");
global.valid_ssaform = FALSE;
result = ((serfun0_p)serfun) ();
result = serfun ();
global.valid_ssaform = TRUE;
SetCurrentFundefHead (NULL);
......
......@@ -21,14 +21,17 @@ ApplyCF (te_info *info, ntype *args)
switch (TYgetProductSize (args)) {
case 1:
res = ((monCF)TEgetCFFun (info)) (TYgetValue (TYgetProductMember (args, 0)));
res = (TEgetCFFun (info)) (TYgetValue (TYgetProductMember (args, 0)),
NULL,
NULL);
break;
case 2:
res = ((binCF)TEgetCFFun (info)) (TYgetValue (TYgetProductMember (args, 0)),
TYgetValue (TYgetProductMember (args, 1)));
res = (TEgetCFFun (info)) (TYgetValue (TYgetProductMember (args, 0)),
TYgetValue (TYgetProductMember (args, 1)),
NULL);
break;
case 3:
res = ((triCF)TEgetCFFun (info)) (TYgetValue (TYgetProductMember (args, 0)),
res = (TEgetCFFun (info)) (TYgetValue (TYgetProductMember (args, 0)),
TYgetValue (TYgetProductMember (args, 1)),
TYgetValue (TYgetProductMember (args, 2)));
break;
......
......@@ -144,17 +144,17 @@ SWRmodule (node *arg_node, info *arg_info)
DBUG_RETURN (arg_node);
}
bool
isLocalInstance (node *fundef, bool result)
static bool *
isLocalInstance (node *fundef, bool *result)
{
DBUG_ENTER ();
result = result | FUNDEF_ISLOCAL (fundef);
*result = *result | FUNDEF_ISLOCAL (fundef);
DBUG_RETURN (result);
}
bool
static bool
containsLocalInstances (node *wrapper)
{
bool result;
......@@ -165,10 +165,11 @@ containsLocalInstances (node *wrapper)
result = FUNDEF_ISLOCAL (FUNDEF_IMPL (wrapper));
} else {
void *fold;
bool check = FALSE;
fold = TYfoldFunctionInstances (FUNDEF_WRAPPERTYPE (wrapper),
(void *(*)(node *, void *))isLocalInstance,
(void *)FALSE);
(void *)&check);
/*
* we have to use this instead of casting fold to bool
......
......@@ -950,8 +950,12 @@ typedef struct MODULE_T {
int usecount;
} module_t;
typedef node *(*serfun_p) (void *);
typedef node *(*serfun0_p) (void);
/*
* The serfun_* types are used by modulemanager and the serialise/de-serialise
* traversals to access serialised functions. The functions are *never* defined
* as having an argument (i.e. void *(*)(void)).
*/
typedef node *(*serfun_p) (void);
typedef union {
void *v;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment