antirez / antirez/load81

Compilation warnings: `pixel` set but not used, misleading indentation.

Open
#66 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
739
Forks
65
PR merge metrics
No merged PRs in 30d

Description

It compiles and runs fine, this is just some warnings with GCC 10.2.1 20201203 on Linux ppc64le.
I’m preparing a pull request.

```
$ make
cc -O2 -Wall -W -Ilua/src `pkg-config --cflags sdl2 SDL2_gfx SDL2_image` -c -o load81.o load81.c
load81.c: In function 'getpixelBinding':
load81.c:216:12: warning: variable 'pixel' set but not used [-Wunused-but-set-variable]
216 | Uint32 pixel;
| ^~~~~
cc -O2 -Wall -W -Ilua/src `pkg-config --cflags sdl2 SDL2_gfx SDL2_image` -c -o editor.o editor.c
cc -O2 -Wall -W -Ilua/src `pkg-config --cflags sdl2 SDL2_gfx SDL2_image` -c -o framebuffer.o framebuffer.c
(cd lua && make ansi)
make[1]: Entering directory '/tmp/ramdisk/load81/lua'
cd src && make ansi
make[2]: Entering directory '/tmp/ramdisk/load81/lua/src'
make all MYCFLAGS=-DLUA_ANSI
make[3]: Entering directory '/tmp/ramdisk/load81/lua/src'
gcc -O2 -Wall -DLUA_ANSI -c -o lapi.o lapi.c
gcc -O2 -Wall -DLUA_ANSI -c -o lcode.o lcode.c
gcc -O2 -Wall -DLUA_ANSI -c -o ldebug.o ldebug.c
gcc -O2 -Wall -DLUA_ANSI -c -o ldo.o ldo.c
gcc -O2 -Wall -DLUA_ANSI -c -o ldump.o ldump.c
gcc -O2 -Wall -DLUA_ANSI -c -o lfunc.o lfunc.c
gcc -O2 -Wall -DLUA_ANSI -c -o lgc.o lgc.c
gcc -O2 -Wall -DLUA_ANSI -c -o llex.o llex.c
gcc -O2 -Wall -DLUA_ANSI -c -o lmem.o lmem.c
gcc -O2 -Wall -DLUA_ANSI -c -o lobject.o lobject.c
gcc -O2 -Wall -DLUA_ANSI -c -o lopcodes.o lopcodes.c
gcc -O2 -Wall -DLUA_ANSI -c -o lparser.o lparser.c
gcc -O2 -Wall -DLUA_ANSI -c -o lstate.o lstate.c
gcc -O2 -Wall -DLUA_ANSI -c -o lstring.o lstring.c
gcc -O2 -Wall -DLUA_ANSI -c -o ltable.o ltable.c
gcc -O2 -Wall -DLUA_ANSI -c -o ltm.o ltm.c
gcc -O2 -Wall -DLUA_ANSI -c -o lundump.o lundump.c
gcc -O2 -Wall -DLUA_ANSI -c -o lvm.o lvm.c
gcc -O2 -Wall -DLUA_ANSI -c -o lzio.o lzio.c
gcc -O2 -Wall -DLUA_ANSI -c -o lauxlib.o lauxlib.c
lauxlib.c: In function 'luaL_loadfile':
lauxlib.c:577:4: warning: this 'while' clause does not guard... [-Wmisleading-indentation]
577 | while ((c = getc(lf.f)) != EOF && c != LUA_SIGNATURE[0]) ;
| ^~~~~
lauxlib.c:578:5: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'while'
578 | lf.extraline = 0;
| ^~
gcc -O2 -Wall -DLUA_ANSI -c -o lbaselib.o lbaselib.c
gcc -O2 -Wall -DLUA_ANSI -c -o ldblib.o ldblib.c
gcc -O2 -Wall -DLUA_ANSI -c -o liolib.o liolib.c
gcc -O2 -Wall -DLUA_ANSI -c -o lmathlib.o lmathlib.c
gcc -O2 -Wall -DLUA_ANSI -c -o loslib.o loslib.c
gcc -O2 -Wall -DLUA_ANSI -c -o ltablib.o ltablib.c
ltablib.c: In function 'addfield':
ltablib.c:137:3: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
137 | if (!lua_isstring(L, -1))
| ^~
ltablib.c:140:5: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
140 | luaL_addvalue(b);
| ^~~~~~~~~~~~~
gcc -O2 -Wall -DLUA_ANSI -c -o lstrlib.o lstrlib.c
gcc -O2 -Wall -DLUA_ANSI -c -o loadlib.o loadlib.c
gcc -O2 -Wall -DLUA_ANSI -c -o linit.o linit.c
ar rcu liblua.a lapi.o lcode.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o lmem.o lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o ltm.o lundump.o lvm.o lzio.o lauxlib.o lbaselib.o ldblib.o liolib.o lmathlib.o loslib.o ltablib.o lstrlib.o loadlib.o linit.o # DLL needs all object files
ar: `u' modifier ignored since `D' is the default (see `U')
ranlib liblua.a
gcc -O2 -Wall -DLUA_ANSI -c -o lua.o lua.c
gcc -o lua lua.o liblua.a -lm
/usr/bin/ld: liblua.a(loslib.o): in function `os_tmpname':
loslib.c:(.text+0x4e4): warning: the use of `tmpnam' is dangerous, better use `mkstemp'
gcc -O2 -Wall -DLUA_ANSI -c -o luac.o luac.c
gcc -O2 -Wall -DLUA_ANSI -c -o print.o print.c
gcc -o luac luac.o print.o liblua.a -lm
make[3]: Leaving directory '/tmp/ramdisk/load81/lua/src'
make[2]: Leaving directory '/tmp/ramdisk/load81/lua/src'
make[1]: Leaving directory '/tmp/ramdisk/load81/lua'
cc load81.o editor.o framebuffer.o lua/src/liblua.a lua/src/liblua.a -lm `pkg-config --libs sdl2 SDL2_gfx SDL2_image` -o load81
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.