Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[portability] Report us ANY compiler error, warning you encounter. #103

Open
ThakeeNathees opened this issue Jun 22, 2021 · 1 comment
Open
Labels
good first issue Good for newcomers portability Platform / compiler specific issues

Comments

@ThakeeNathees
Copy link
Owner

We're trying to make pocketlang sources as portable as possible and get rid of any and all compiler warnings.

Compile the pocketlang source with any of your preferred c99 compiler (gcc -o pocket cli/*.c src/*.c -Isrc/include -lm see here for more) with -Wall, -Wextra flags and report us whatever error or warning it shows, by opening an issue.

And if you like to resolve those warnings yourself, we're happy to have your PR.

@ThakeeNathees ThakeeNathees added good first issue Good for newcomers portability Platform / compiler specific issues labels Jun 22, 2021
@masrourmouad
Copy link

masrourmouad commented Jul 4, 2021

gcc 4.9 32bit without "-std=c11" sources: 025ede8

gcc -I./src/include -MMD -MP -fPIC -D DEBUG -g3 -Og -c src/pk_core.c -o build/debug/./src/pk_core.o
src/pk_core.c: In function ‘pkGetFunction’:
src/pk_core.c:86:3: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode
for (uint32_t i = 0; i < script->functions.count; i++) {
^
src/pk_core.c:86:3: note: use option -std=c99, -std=gnu99, -std=c11 or -std=gnu11 to compile your code
src/pk_core.c: In function ‘findBuiltinFunction’:
src/pk_core.c:414:4: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode
for (uint32_t i = 0; i < vm->builtins_count; i++) {
^
src/pk_core.c: In function ‘corePrint’:
src/pk_core.c:604:3: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode
for (int i = 1; i <= ARGC; i++) {
^
src/pk_core.c: In function ‘stdLangWrite’:
src/pk_core.c:871:3: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode
for (int i = 1; i <= ARGC; i++) {
^
src/pk_core.c: In function ‘stdFiberRun’:
src/pk_core.c:1096:3: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode
for (int i = 1; i < argc; i++) {
^
src/pk_core.c: In function ‘varContains’:
src/pk_core.c:1467:7: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode
for (uint32_t i = 0; i < list->elements.count; i++) {
^
Makefile:42: recipe for target 'build/debug/./src/pk_core.o' failed
make: *** [build/debug/./src/pk_core.o] Error 1

with "-std=c11"-------------------------------------------------------------------------------------------------------->

gcc -I./src/include -MMD -MP -fPIC -std=c11 -D DEBUG -g3 -Og -c src/pk_core.c -o build/debug/./src/pk_core.o
gcc -I./src/include -MMD -MP -fPIC -std=c11 -D DEBUG -g3 -Og -c src/pk_utils.c -o build/debug/./src/pk_utils.o
gcc -I./src/include -MMD -MP -fPIC -std=c11 -D DEBUG -g3 -Og -c src/pk_vm.c -o build/debug/./src/pk_vm.o
gcc -I./src/include -MMD -MP -fPIC -std=c11 -D DEBUG -g3 -Og -c src/pk_debug.c -o build/debug/./src/pk_debug.o
gcc -I./src/include -MMD -MP -fPIC -std=c11 -D DEBUG -g3 -Og -c src/pk_compiler.c -o build/debug/./src/pk_compiler.o
gcc -I./src/include -MMD -MP -fPIC -std=c11 -D DEBUG -g3 -Og -c src/pk_var.c -o build/debug/./src/pk_var.o
gcc -I./src/include -MMD -MP -fPIC -std=c11 -D DEBUG -g3 -Og -c cli/main.c -o build/debug/./cli/main.o
gcc -I./src/include -MMD -MP -fPIC -std=c11 -D DEBUG -g3 -Og -c cli/uitls.c -o build/debug/./cli/uitls.o
cli/uitls.c: In function ‘byteBufferClear’:
cli/uitls.c:37:3: warning: ignoring return value of ‘realloc’, declared with attribute warn_unused_result [-Wunused-result]
realloc(buffer->data, 0);
^
gcc -I./src/include -MMD -MP -fPIC -std=c11 -D DEBUG -g3 -Og -c cli/repl.c -o build/debug/./cli/repl.o
gcc -I./src/include -MMD -MP -fPIC -std=c11 -D DEBUG -g3 -Og -c cli/thirdparty.c -o build/debug/./cli/thirdparty.o
gcc -I./src/include -MMD -MP -fPIC -std=c11 -D DEBUG -g3 -Og -c cli/utils.c -o build/debug/./cli/utils.o
gcc -I./src/include -MMD -MP -fPIC -std=c11 -D DEBUG -g3 -Og -c cli/modules.c -o build/debug/./cli/modules.o
gcc -I./src/include -MMD -MP -fPIC -std=c11 -D DEBUG -g3 -Og -c cli/all.c -o build/debug/./cli/all.o
In file included from cli/all.c:26:0:
cli/modules/path.c: In function ‘_pathAbspath’:
cli/modules/path.c:110:8: error: too few arguments to function ‘pkGetArgString’
if (!pkGetArgString(vm, 1, &path)) return;
^
In file included from cli/modules/path.c:8:0,
from cli/all.c:26:
./src/include/pocketlang.h:379:16: note: declared here
PK_PUBLIC bool pkGetArgString(PKVM* vm, int arg,
^
In file included from cli/all.c:26:0:
cli/modules/path.c: In function ‘_pathRelpath’:
cli/modules/path.c:122:8: error: too few arguments to function ‘pkGetArgString’
if (!pkGetArgString(vm, 1, &from)) return;
^
In file included from cli/modules/path.c:8:0,
from cli/all.c:26:
./src/include/pocketlang.h:379:16: note: declared here
PK_PUBLIC bool pkGetArgString(PKVM* vm, int arg,
^
In file included from cli/all.c:26:0:
cli/modules/path.c:123:8: error: too few arguments to function ‘pkGetArgString’
if (!pkGetArgString(vm, 2, &path)) return;
^
In file included from cli/modules/path.c:8:0,
from cli/all.c:26:
./src/include/pocketlang.h:379:16: note: declared here
PK_PUBLIC bool pkGetArgString(PKVM* vm, int arg,
^
In file included from cli/all.c:26:0:
cli/modules/path.c: In function ‘_pathJoin’:
cli/modules/path.c:141:5: error: too few arguments to function ‘pkGetArgString’
pkGetArgString(vm, i+1, &paths[i]);
^
In file included from cli/modules/path.c:8:0,
from cli/all.c:26:
./src/include/pocketlang.h:379:16: note: declared here
PK_PUBLIC bool pkGetArgString(PKVM* vm, int arg,
^
In file included from cli/all.c:26:0:
cli/modules/path.c: In function ‘_pathNormalize’:
cli/modules/path.c:152:8: error: too few arguments to function ‘pkGetArgString’
if (!pkGetArgString(vm, 1, &path)) return;
^
In file included from cli/modules/path.c:8:0,
from cli/all.c:26:
./src/include/pocketlang.h:379:16: note: declared here
PK_PUBLIC bool pkGetArgString(PKVM* vm, int arg,
^
In file included from cli/all.c:26:0:
cli/modules/path.c: In function ‘_pathBaseName’:
cli/modules/path.c:161:8: error: too few arguments to function ‘pkGetArgString’
if (!pkGetArgString(vm, 1, &path)) return;
^
In file included from cli/modules/path.c:8:0,
from cli/all.c:26:
./src/include/pocketlang.h:379:16: note: declared here
PK_PUBLIC bool pkGetArgString(PKVM* vm, int arg,
^
In file included from cli/all.c:26:0:
cli/modules/path.c: In function ‘_pathDirName’:
cli/modules/path.c:171:8: error: too few arguments to function ‘pkGetArgString’
if (!pkGetArgString(vm, 1, &path)) return;
^
In file included from cli/modules/path.c:8:0,
from cli/all.c:26:
./src/include/pocketlang.h:379:16: note: declared here
PK_PUBLIC bool pkGetArgString(PKVM* vm, int arg,
^
In file included from cli/all.c:26:0:
cli/modules/path.c: In function ‘_pathIsPathAbs’:
cli/modules/path.c:180:8: error: too few arguments to function ‘pkGetArgString’
if (!pkGetArgString(vm, 1, &path)) return;
^
In file included from cli/modules/path.c:8:0,
from cli/all.c:26:
./src/include/pocketlang.h:379:16: note: declared here
PK_PUBLIC bool pkGetArgString(PKVM* vm, int arg,
^
In file included from cli/all.c:26:0:
cli/modules/path.c: In function ‘_pathGetExtension’:
cli/modules/path.c:187:8: error: too few arguments to function ‘pkGetArgString’
if (!pkGetArgString(vm, 1, &path)) return;
^
In file included from cli/modules/path.c:8:0,
from cli/all.c:26:
./src/include/pocketlang.h:379:16: note: declared here
PK_PUBLIC bool pkGetArgString(PKVM* vm, int arg,
^
In file included from cli/all.c:26:0:
cli/modules/path.c: In function ‘_pathExists’:
cli/modules/path.c:200:8: error: too few arguments to function ‘pkGetArgString’
if (!pkGetArgString(vm, 1, &path)) return;
^
In file included from cli/modules/path.c:8:0,
from cli/all.c:26:
./src/include/pocketlang.h:379:16: note: declared here
PK_PUBLIC bool pkGetArgString(PKVM* vm, int arg,
^
In file included from cli/all.c:26:0:
cli/modules/path.c: In function ‘_pathIsFile’:
cli/modules/path.c:206:8: error: too few arguments to function ‘pkGetArgString’
if (!pkGetArgString(vm, 1, &path)) return;
^
In file included from cli/modules/path.c:8:0,
from cli/all.c:26:
./src/include/pocketlang.h:379:16: note: declared here
PK_PUBLIC bool pkGetArgString(PKVM* vm, int arg,
^
In file included from cli/all.c:26:0:
cli/modules/path.c: In function ‘_pathIsDir’:
cli/modules/path.c:212:8: error: too few arguments to function ‘pkGetArgString’
if (!pkGetArgString(vm, 1, &path)) return;
^
In file included from cli/modules/path.c:8:0,
from cli/all.c:26:
./src/include/pocketlang.h:379:16: note: declared here
PK_PUBLIC bool pkGetArgString(PKVM* vm, int arg,
^
Makefile:42: recipe for target 'build/debug/./cli/all.o' failed
make: *** [build/debug/./cli/all.o] Error 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers portability Platform / compiler specific issues
Projects
None yet
Development

No branches or pull requests

2 participants