Compile with gcc-12.2.0
Closed this issue · 6 comments
Hi, after upgrading from gcc-11.x to 12.2.0, Im struggling compiling swell on linux-5.10.158.
I've noticed warnings are treated as errors now
g++ -pipe -fvisibility=hidden -fno-math-errno -fPIC -DPIC -Wall -Wshadow -Wno-unused-function
-Wno-multichar -Wtype-limits -DSWELL_MAKING_DYLIB -D_FILE_OFFSET_BITS=64 -Wno-unused-result -Werror -Wno-deprecated-declarations -O2 -DNDEBUG -s -DSWELL_TARGET_GDK=2 -pthread -I/usr/include/gtk-2.0 -I/usr/lib64/gtk-2.0/include -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/fribidi -I/usr/include/harfbuzz -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng16 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -DSWELL_LICE_GDI -DSWELL_FREETYPE -I/usr/include/freetype2 -I/usr/include/libpng16 -DSWELL_FONTCONFIG -c -o swell.o swell.cpp
g++ -pipe -fvisibility=hidden -fno-math-errno -fPIC -DPIC -Wall -Wshadow -Wno-unused-function
-Wno-multichar -Wtype-limits -DSWELL_MAKING_DYLIB -D_FILE_OFFSET_BITS=64 -Wno-unused-result -Werror -Wno-deprecated-declarations -O2 -DNDEBUG -s -DSWELL_TARGET_GDK=2 -pthread -I/usr/include/gtk-2.0 -I/usr/lib64/gtk-2.0/include -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/fribidi -I/usr/include/harfbuzz -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng16 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -DSWELL_LICE_GDI -DSWELL_FREETYPE -I/usr/include/freetype2 -I/usr/include/libpng16 -DSWELL_FONTCONFIG -c -o swell-ini.o swell-ini.cpp
g++ -pipe -fvisibility=hidden -fno-math-errno -fPIC -DPIC -Wall -Wshadow -Wno-unused-function
-Wno-multichar -Wtype-limits -DSWELL_MAKING_DYLIB -D_FILE_OFFSET_BITS=64 -Wno-unused-result -Werror -Wno-deprecated-declarations -O2 -DNDEBUG -s -DSWELL_TARGET_GDK=2 -pthread -I/usr/include/gtk-2.0 -I/usr/lib64/gtk-2.0/include -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/fribidi -I/usr/include/harfbuzz -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng16 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -DSWELL_LICE_GDI -DSWELL_FREETYPE -I/usr/include/freetype2 -I/usr/include/libpng16 -DSWELL_FONTCONFIG -c -o swell-miscdlg-generic.o swell-miscdlg-generic.cpp
In file included from swell.h:54,
from swell-miscdlg-generic.cpp:30:
swell-miscdlg-generic.cpp: In function 'LRESULT swellFileSelectProc(HWND, UINT, WPARAM, LPARAM)':
swell-types.h:78:31: error: value computed is not used [-Werror=unused-value]
78 | #define CreateDirectory(x,y) (!mkdir((x),0755))
| ~^~~~~~~~~~~~~~~~~
swell-miscdlg-generic.cpp:855:22: note: in expansion of macro 'CreateDirectory'
855 | CreateDirectory(buf,NULL);
| ^~~~~~~~~~~~~~~
In file included from swell-miscdlg-generic.cpp:42:
In function 'bool WDL_hasStringsEx2(const char**, int, const LineParser*, int (*)(const char*, int, const char*, int))',
inlined from 'bool WDL_hasStringsEx(const char*, const LineParser*, int (*)(const char*, int, const char*, int))' at ../has_strings.h:251:27,
inlined from 'bool WDL_hasStrings(const char*, const LineParser*)' at ../has_strings.h:256:26,
inlined from 'void BrowseFile_State::viewlist_sort(const char*)' at swell-miscdlg-generic.cpp:230:40:
../has_strings.h:65:28: error: array subscript 1 is outside array bounds of 'const char [1]' [-Werror=array-bounds]
65 | if (n[0] == '(' && !n[1] && !lp->gettoken_quotingchar(x))
| ~~~^
cc1plus: all warnings being treated as errors
make: *** [<builtin>: swell-miscdlg-generic.o] Error 1
I have tried to add to makefile -Wno-unused-value
to CFLAGS and also -Wno-error=array-bounds
but unfortunatly it just makes it worse down the chain.
Any help would be appreciated.
g++ -pipe -fvisibility=hidden -fno-math-errno -fPIC -DPIC -Wall -Wshadow -Wno-unused-value -Wno-multichar -Wtype-limits -Wno-error=array-bounds -DSWELL_MAKING_DYLIB -D_FILE_OFFSET_BITS=64
-Wno-unused-result -Werror -Wno-deprecated-declarations -O2 -DNDEBUG -s -DSWELL_TARGET_GDK=2 -pthread -I/usr/include/gtk-2.0 -I/usr/lib64/gtk-2.0/include -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/fribidi -I/usr/include/harfbuzz -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng16 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -DSWELL_LICE_GDI -DSWELL_FREETYPE -I/usr/include/freetype2 -I/usr/include/libpng16 -DSWELL_FONTCONFIG -c -o swell-gdi-lice.o swell-gdi-lice.cpp
swell-gdi-lice.cpp: In function 'void SWELL_internalLICEpaint(HWND, LICE_IBitmap*, int, int, bool)':
swell-gdi-lice.cpp:1590:36: error: storing the address of local variable 'ctx' in '*hwnd.HWND__::m_paintctx' [-Werror=dangling-pointer=]
1590 | if (forceref) hwnd->m_paintctx = &ctx;
| ~~~~~~~~~~~~~~~~~^~~~~~
swell-gdi-lice.cpp:1579:27: note: 'ctx' declared here
1579 | swell_gdpLocalContext ctx;
| ^~~
swell-gdi-lice.cpp:1579:27: note: 'hwnd' declared here
cc1plus: all warnings being treated as errors
make: *** [<builtin>: swell-gdi-lice.o] Error 1
You can pass ALLOW_WARNINGS=1
to make
to have it not enable -Werror
.
hm unfortunatly i did not take, get the same error as in first post
Did you run it as make ALLOW_WARNINGS=1
? Could also just comment out the CFLAGS += -Werror
line in the Makefile.
Yes, however I tried yet again adding to Makefile line 145
CXXFLAGS = $(CFLAGS) -Wno-error=unused-value -Wno-error=array-bounds -Wno-error=dangling-pointer
and it builds, crossing fingers this dont crap out on me ;)
Well Reaper runs and terminal shows no warnings/errors so far, tested creating a new directory from filemanager with no issue.. Im closing this as this might only be a local issue when building on voidlinux.