fixes some compiler warnings

This commit is contained in:
overflowerror 2021-05-05 22:50:29 +02:00
parent ae0fda3384
commit eea92f908e
4 changed files with 6 additions and 4 deletions

View file

@ -69,7 +69,7 @@ char* generateMarshallFunction(FILE* output, struct structinfo* info, char* suff
fprintf(output, "\t%s* d = (%s*) _d;\n", info->names[0], info->names[0]);
fprintf(output, "\tif (d == NULL)\n");
fprintf(output, "\t\treturn json_null();\n");
fprintf(output, "\treturn json_object(true, %d,\n", info->memberno);
fprintf(output, "\treturn json_object(true, %ld,\n", info->memberno);
for (size_t i = 0; i < info->memberno; i++) {
struct memberinfo* member = info->members[i];

View file

@ -133,7 +133,7 @@ type: STDINT { yyerror(filename, ERROR("stdint types are not yet supported"));
| ID { $$ = newTypeInfo(false, $1); }
| type POINTER
{
if ($1->isPointer || $1->type == "string") {
if ($1->isPointer || strcmp($1->type, "string") == 0) {
yyerror(filename, ERROR("multiple pointer types are not supported"));
YYERROR;
} else {

View file

@ -22,7 +22,9 @@ const_string "const"{whitespace}*{string}
%option noyywrap
%option nodefault
%option yylineno
%option nounput
%option noinput
%option yylineno
%x COMMENT
%%

View file

@ -14,7 +14,7 @@ typedef struct {
bool boolValue;
const char* stringValue;
char* stringValue;
char* stringValue2;
struct_t structValue;