Skip to content
This repository was archived by the owner on Nov 23, 2020. It is now read-only.
This repository was archived by the owner on Nov 23, 2020. It is now read-only.

Failed to build on Windows, errors in compile.c #51

@ghost

Description

@H2CO3 @jcubic @mattfenwick @sfan5 @idmitrievsky

macOS/Linux/iOS - successfully compiled.

Windows:

sed: -e expression #1, char 1: unknown command: `''
sed: -e expression #1, char 1: unknown command: `''
gcc -c -std=c89 -pedantic -fpic -fstrict-aliasing -Wall -Wextra -Werror -Wno-error=unused-function -Wno-error=sign-compare -Wno-parentheses -Wno-error=pointer-to-int-cast -Wno-error=uninitialized -Wno-unused-parameter -Wno-missing-field-initializers -Wno-error=pedantic -D_XOPEN_SOURCE=700 -DSPARKLING_LIBDIR_RAW="/usr/local/lib/sparkling/" -DUSE_LIBEDIT=1 -DUSE_ANSI_COLORS=1 -DUSE_DYNAMIC_LOADING=1 -O0 -g -pg -DDEBUG -o bld/api.o src/api.c
src/api.c: In function 'spn_object_description':
src/api.c:91:3: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
   (unsigned long)(obj)
   ^
src/api.c: In function 'spn_hash_value':
src/api.c:350:10: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
   return (unsigned long)(ptrvalue(key));
          ^
src/api.c:355:33: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
   return hashfn ? hashfn(obj) : (unsigned long)(obj);
                                 ^
In file included from src/misc.h:14,
                 from src/api.c:22:
src/api.c: In function 'spn_typetag_name':
src/api.c:508:14: warning: comparison of integer expressions of different signedness: 'int' and 'long long unsigned int' [-Wsign-compare]
  assert(ttag < COUNT(typenames));
              ^
gcc -c -std=c89 -pedantic -fpic -fstrict-aliasing -Wall -Wextra -Werror -Wno-error=unused-function -Wno-error=sign-compare -Wno-parentheses -Wno-error=pointer-to-int-cast -Wno-error=uninitialized -Wno-unused-parameter -Wno-missing-field-initializers -Wno-error=pedantic -D_XOPEN_SOURCE=700 -DSPARKLING_LIBDIR_RAW="/usr/local/lib/sparkling/" -DUSE_LIBEDIT=1 -DUSE_ANSI_COLORS=1 -DUSE_DYNAMIC_LOADING=1 -O0 -g -pg -DDEBUG -o bld/array.o src/array.c
gcc -c -std=c89 -pedantic -fpic -fstrict-aliasing -Wall -Wextra -Werror -Wno-error=unused-function -Wno-error=sign-compare -Wno-parentheses -Wno-error=pointer-to-int-cast -Wno-error=uninitialized -Wno-unused-parameter -Wno-missing-field-initializers -Wno-error=pedantic -D_XOPEN_SOURCE=700 -DSPARKLING_LIBDIR_RAW="/usr/local/lib/sparkling/" -DUSE_LIBEDIT=1 -DUSE_ANSI_COLORS=1 -DUSE_DYNAMIC_LOADING=1 -O0 -g -pg -DDEBUG -o bld/ast.o src/ast.c
gcc -c -std=c89 -pedantic -fpic -fstrict-aliasing -Wall -Wextra -Werror -Wno-error=unused-function -Wno-error=sign-compare -Wno-parentheses -Wno-error=pointer-to-int-cast -Wno-error=uninitialized -Wno-unused-parameter -Wno-missing-field-initializers -Wno-error=pedantic -D_XOPEN_SOURCE=700 -DSPARKLING_LIBDIR_RAW="/usr/local/lib/sparkling/" -DUSE_LIBEDIT=1 -DUSE_ANSI_COLORS=1 -DUSE_DYNAMIC_LOADING=1 -O0 -g -pg -DDEBUG -o bld/compiler.o src/compiler.c
In file included from C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/x86_64-w64-mingw32/include/windef.h:8,
                 from C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/x86_64-w64-mingw32/include/Windows.h:69,
                 from src/misc.h:22,
                 from src/compiler.c:21:
src/compiler.c:407:16: error: expected identifier or '(' before 'int'
 static int max(int x, int y)
                ^~~
src/compiler.c:407:12: error: expected ')' before '>' token
 static int max(int x, int y)
            ^~~
src/compiler.c:407:12: error: expected ')' before '?' token
 static int max(int x, int y)
            ^~~
In file included from src/misc.h:14,
                 from src/compiler.c:21:
src/compiler.c: In function 'search_upvalues':
src/compiler.c:592:47: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long long unsigned int'} and 'int' [-Wsign-compare]
   assert(spn_array_count(node->index_to_desc) == upval_idx);
                                               ^~
src/compiler.c:614:46: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long long unsigned int'} and 'int' [-Wsign-compare]
  assert(spn_array_count(node->index_to_desc) == flat_upvalidx);
                                              ^~
At top level:
src/compiler.c:706:13: warning: 'emit_ins_long' defined but not used [-Wunused-function]
 static void emit_ins_long(SpnCompiler *cmp, enum spn_vm_ins opcode,
             ^~~~~~~~~~~~~
make: *** [Makefile:124: bld/compiler.o] Error 1

OS: Windows 10
CPU: x86_64
GCC: 8.0.1

All requirements installed via mingw

Errors:

In file included from C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/x86_64-w64-mingw32/include/windef.h:8,
                 from C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/x86_64-w64-mingw32/include/Windows.h:69,
                 from src/misc.h:22,
                 from src/compiler.c:21:
src/compiler.c:407:16: error: expected identifier or '(' before 'int'
 static int max(int x, int y)
                ^~~
src/compiler.c:407:12: error: expected ')' before '>' token
 static int max(int x, int y)
            ^~~
src/compiler.c:407:12: error: expected ')' before '?' token
 static int max(int x, int y)
            ^~~

Place in code:

static int max(int x, int y)
{
	return x > y ? x : y;
}

I can't understand why this is an error. Maybe @H2CO3 can help me.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions