Commit Graph

74 Commits

Author SHA1 Message Date
David Korth
191cbab172 [cmake] gcc.cmake: Add some more clang libc++ hardening options.
These options are now only applied if compiling with clang.

While it's possible to use libc++ with gcc, it requires a lot of manual
changes, and basicaly no one does it. (libstdc++ with clang is commonly
done on desktop Linux systems, though.)

Don't -D_LIBCPP_ENABLE_ASSERTIONS on clang-17 or later. It's deprecated,
and may result in a compile error. (...though on Android/Termux with
clang-20.1.3, it didn't...)
2025-04-28 18:22:21 -04:00
David Korth
3e853a59da [cmake] Don't enable -Werror or /WX by default; add a CMake option -DENABLE_WERROR.
Newer compilers usually add more warnings, so having -Werror by default
will most likely result in a compile error when new compiler versions
are released.

MSVC: Remove "-D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING". This is no
longer relevant, since we don't support anything older than MSVC 2015.
2025-04-28 18:19:53 -04:00
David Korth
7d379f826d [cmake] gcc.cmake: Fix DT_RELR enablement.
Some checks are pending
Codecov / run (push) Waiting to run
CodeQL / Analyze (cpp) (push) Waiting to run
It seems this was broken since it was initially implemented in v2.0
in commit d732fbc010
([cmake] platform/gcc.cmake: Initial support for detecting DT_RELR.)
because TMP_HAVE_DT_RELR was unset too early.
2025-04-28 01:03:31 -04:00
David Korth
28b649388d [librptext/tests] TextFuncsTest: Work around the aggressive-loop-optimizations warning.
When compiling with LTO enabled on gcc-14.2.0 (e.g. with Ubuntu 25.04),
the following warning (as error) appeared. Work around it by checking for
str.empty() before resizing the string.

[cmake] gcc.cmake: Remove -Wno-error=aggressive-loop-optimizations, since
it's no longe needed.

In function ‘assign’,
    inlined from ‘_S_assign’ at /usr/include/c++/14/bits/basic_string.h:455:23,
    inlined from ‘_S_assign’ at /usr/include/c++/14/bits/basic_string.h:450:7,
    inlined from ‘_M_replace_aux’ at /usr/include/c++/14/bits/basic_string.tcc:471:17,
    inlined from ‘append’ at /usr/include/c++/14/bits/basic_string.h:1499:30,
    inlined from ‘resize’ at /usr/include/c++/14/bits/basic_string.tcc:405:14,
    inlined from ‘resize’ at /usr/include/c++/14/bits/basic_string.h:1119:21,
    inlined from ‘TestBody’ at src/librptext/tests/TextFuncsTest.cpp:513:12:
/usr/include/c++/14/bits/char_traits.h:837:25: error: iteration 9223372036854775807 invokes undefined behavior [-Werror=aggressive-loop-optimizations]
  837 |           assign(__s[__i], __a);
      |                         ^
/usr/include/c++/14/bits/char_traits.h:836:34: note: within this loop
  836 |         for (size_t __i = 0; __i < __n; ++__i)
      |                                  ^
In function ‘assign’,
    inlined from ‘_S_assign’ at /usr/include/c++/14/bits/basic_string.h:455:23,
    inlined from ‘_S_assign’ at /usr/include/c++/14/bits/basic_string.h:450:7,
    inlined from ‘_M_replace_aux’ at /usr/include/c++/14/bits/basic_string.tcc:471:17,
    inlined from ‘append’ at /usr/include/c++/14/bits/basic_string.h:1499:30,
    inlined from ‘resize’ at /usr/include/c++/14/bits/basic_string.tcc:405:14,
    inlined from ‘resize’ at /usr/include/c++/14/bits/basic_string.h:1119:21,
    inlined from ‘TestBody’ at src/librptext/tests/TextFuncsTest.cpp:542:12:
/usr/include/c++/14/bits/char_traits.h:837:25: error: iteration 9223372036854775807 invokes undefined behavior [-Werror=aggressive-loop-optimizations]
  837 |           assign(__s[__i], __a);
      |                         ^
/usr/include/c++/14/bits/char_traits.h:836:34: note: within this loop
  836 |         for (size_t __i = 0; __i < __n; ++__i)
      |                                  ^
lto1: all warnings being treated as errors
lto-wrapper: fatal error: /usr/bin/c++ returned 1 exit status
compilation terminated.
2025-04-20 11:34:43 -04:00
David Korth
108c853840 [cmake] gcc.cmake: -Wno-error=aggressive-loop-optimizations
This showed up on Ubuntu 25.04 with gcc-14.2.0. It didn't show up on my
laptop with gcc-14.2.1_p20250301...

(cherry picked from commit a904f3c408)
2025-04-20 05:37:44 -04:00
David Korth
d6fc415460 [cmake] gcc.cmake: Move -Wno-error=stringop-overread here.
The same error showed up on armhf and amd64 this time.

Since it's happening in LTO and not the main compiler step, the pragmas
likely aren't working properly. Use -Wno-error=stringop-overread instead.

(cherry picked from commit ec441b4cec)
2025-04-20 05:37:30 -04:00
David Korth
fc9bcc275f [cmake] gcc.cmake: -Wno-error=cast-align
The Ubuntu 16.04 Launchpad build for armhf failed due to a potential
alignment issue:

/<<PKGBUILDDIR>>/src/kde/AchQtDBus.cpp: In member function ‘int AchQtDBus::notifyFunc(LibRpBase::Achievements::ID)’:
/<<PKGBUILDDIR>>/src/kde/AchQtDBus.cpp:149:59: error: cast from ‘uchar* {aka unsigned char*}’ to ‘LibRpTexture::argb32_t*’ increases required alignment of target type [-Werror=cast-align]
   argb32_t *bits = reinterpret_cast<argb32_t*>(icon.bits());
                                                           ^

This shouldn't be an actual problem, since rp_image's image data is
always 16-byte aligned.

NOTE: Not rebuilding the Ubuntu 16.04 packages for ARM because of this.
(Both the armhf and arm64 builds were cancelled.)

(cherry picked from commit 5a08131311)
2025-04-20 04:10:52 -04:00
David Korth
fc4ba5010d [cmake] gcc.cmake: Reduce -Wheader-hygiene to a warning.
clang complains about moc headers due to how automoc handles things:

In file included from build/src/kde/kf5/overlayiconplugin_rom-properties-kf5_autogen/mocs_compilation.cpp:2:
build/src/kde/kf5/overlayiconplugin_rom-properties-kf5_autogen/BKZOEHIFDQ/moc_OverlayIconPluginKF5.cpp:1340:17: error: using namespace directive in global context in header [-Werror,-Wheader-hygiene]
 1340 | using namespace RomPropertiesKF5;
      |                 ^
1 error generated.
2025-04-09 23:20:19 -04:00
David Korth
109676e30e [cmake] gcc.cmake: Make -Woverloaded-virtual not an error.
This clang warning is currently "intentional", though I might rename the
not-virtual open() function later:

In file included from src/libromdata/Handheld/Nintendo3DS.cpp:14:
In file included from src/libromdata/Handheld/Nintendo3DS_p.hpp:19:
src/libromdata/Handheld/../disc/NCCHReader.hpp:193:24: error: 'LibRomData::NCCHReader::open' hides overloaded virtual function [-Werror,-Woverloaded-virtual]
  193 |         LibRpFile::IRpFilePtr open(int section, const char *filename);
      |                               ^
src/libromdata/../librpbase/disc/IPartition.hpp:104:32: note: hidden overloaded virtual function 'LibRpBase::IPartition::open' declared here: different number of parameters (1 vs 2)
  104 |         virtual LibRpFile::IRpFilePtr open(const char *filename);
      |                                       ^
1 error generated.
2025-04-09 23:11:34 -04:00
David Korth
53b2606bdb [cmake] gcc.cmake: Test for "-Wno-error=" options.
Should fix compatibility with older compiles that might lack some of
these warnings.
2025-04-07 19:53:49 -04:00
David Korth
c69c9f864e [cmake] gcc.cmake: Set -Wno-error=clobbered.
Fixes what appears to be a false-positive warning-as-error in the
Release build:

src/librpbase/img/RpPng.cpp: In function ‘LibRpTexture::rp_image_ptr LibRpBase::RpPng::loadPng(png_structp, png_infop)’:
src/librpbase/img/RpPng.cpp:181:42: error: variable ‘color’ might be clobbered by ‘longjmp’ or ‘vfork’ [-Werror=clobbered]
  181 |                                 argb32_t color;
      |                                          ^~~~~
cc1plus: all warnings being treated as errors
2025-04-06 20:31:36 -04:00
David Korth
b8ba2bee67 [microtar] CMakeLists.txt: FIXME: Fix stringop-truncation warnings.
This broke the Ubuntu 22.04 AppVeyor build:

extlib/microtar/src/microtar.c: In function ‘mtar_read_header’:
extlib/microtar/src/microtar.c:111:3: error: ‘__builtin_strncpy’ output may be truncated copying 99 bytes from a string of length 99 [-Werror=stringop-truncation]
  111 |   strncpy(h->name, rh->name, sizeof(h->name));
      |   ^
extlib/microtar/src/microtar.c:112:3: error: ‘__builtin_strncpy’ output may be truncated copying 99 bytes from a string of length 99 [-Werror=stringop-truncation]
  112 |   strncpy(h->linkname, rh->linkname, sizeof(h->linkname));
      |   ^
cc1: all warnings being treated as errors
2025-04-06 19:41:58 -04:00
David Korth
57b586ef91 [cmake] gcc.cmake: Add -Werror.
Note that a bunch of warnings-as-errors are currently suppressed.
They will be removed as the warnings are fixed.
2025-04-06 10:51:30 -04:00
David Korth
a5c23c5543 [cmake] gcc.cmake: Add -fprofile-update=atomic.
This fixes the 'negative' errors from lcov's geninfo.

Before:
  source files: 600
  lines.......: 23.2% (10654 of 45904 lines)
  functions...: 22.8% (848 of 3721 functions)
  branches....: 15.8% (7572 of 47821 branches)

After:
  source files: 600
  lines.......: 23.2% (10654 of 45904 lines)
  functions...: 22.8% (848 of 3721 functions)
  branches....: 15.8% (7572 of 47821 branches)

Effectively no change in coverage, but it's likely more stable.
I'll note that the error was triggering in ASTC decoding, which
uses OpenMP for parallel processing.
2025-01-18 12:10:32 -05:00
David Korth
1bd804820d [cmake] gcc.cmake: Enable C++ assertions and debug mode, when building for Debug.
Assertions are enabled for libstdc++ (gcc) and libc++ (llvm/clang).
Debug mode is enabled for libstdc++ only.

libc++'s hardened mode is also enabled.

libstdc++'s debug mode has already helped find a few bugs:
- GLenumStrings.cpp: sRGB PVRTC v1 was in the wrong place.
- AmiiboData.cpp: Searching for character variants was incorrect.

Not enabled for Release builds, since the assertions cause the program
to crash with SIGABRT.
2024-11-17 11:50:42 -05:00
David Korth
195e742697 [cmake] gcc.cmake: Add -Wno-psabi.
gcc-7.1 and later print a lot of annoying warnings on armhf whenever
passing an iterator to a function:

In file included from /usr/include/c++/13/memory:69,
                 from rom-properties/src/librptexture/stdafx.h:23,
                 from rom-properties/build/src/librptexture/CMakeFiles/rptexture.dir/cmake_pch.hxx:7,
                 from <command-line>:
/usr/include/c++/13/bits/stl_uninitialized.h: In function ‘_ForwardIterator std::__uninitialized_copy_a(_InputIterator, _InputIterator, _ForwardIterator, _Allocator&) [with _InputIterator = move_iterator<_KTX2_Mipmap_Index*>; _ForwardIterator = _KTX2_Mipmap_Index*; _Allocator = rp::default_init_allocator<_KTX2_Mipmap_Index, allocator<_KTX2_Mipmap_Index> >]’:
/usr/include/c++/13/bits/stl_uninitialized.h:344:5: note: parameter passing for argument of type ‘std::move_iterator<_KTX2_Mipmap_Index*>’ changed in GCC 7.1
  344 |     __uninitialized_copy_a(_InputIterator __first, _InputIterator __last,
      |     ^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/stl_uninitialized.h:344:5: note: parameter passing for argument of type ‘std::move_iterator<_KTX2_Mipmap_Index*>’ changed in GCC 7.1
/usr/include/c++/13/bits/stl_uninitialized.h: In function ‘_ForwardIterator std::__uninitialized_move_if_noexcept_a(_InputIterator, _InputIterator, _ForwardIterator, _Allocator&) [with _InputIterator = _KTX2_Mipmap_Index*; _ForwardIterator = _KTX2_Mipmap_Index*; _Allocator = rp::default_init_allocator<_KTX2_Mipmap_Index, allocator<_KTX2_Mipmap_Index> >]’:
/usr/include/c++/13/bits/stl_uninitialized.h:399:9: note: parameter passing for argument of type ‘std::move_iterator<_KTX2_Mipmap_Index*>’ changed in GCC 7.1
  398 |       return std::__uninitialized_copy_a
      |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  399 |         (_GLIBCXX_MAKE_MOVE_IF_NOEXCEPT_ITERATOR(__first),
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  400 |          _GLIBCXX_MAKE_MOVE_IF_NOEXCEPT_ITERATOR(__last), __result, __alloc);
      |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2024-11-13 20:58:05 -05:00
David Korth
6e5d5232fc [cmake] gcc.cmake: Reduce -Wheader-hygiene to just a warning.
We can't easily disable it for just the moc-generated files, so reduce it
from error to warning for now.
2024-09-15 17:17:45 -04:00
David Korth
8c7b3e76bd [cmake] gcc.cmake: Add -Werror=header-hygiene.
Available in clang, but not gcc (as of 14.2).

This ensures that header files (including .cpp files used with #include)
do not have global `using` statements.

NintendoDS_p.hpp: Removed unnecessary `using namespace` statements.

Removed global `using` statements from TCreateThumbnail.cpp and
TImageTypesConfig.cpp. Functions now have localized `using` statements.

Updated calling files to add `using` statements where necessary.

TImageTypesConfig.cpp: Also add a static_assert() for conf_imageTypeNames[].

FIXME: The generated moc files for OverlayIconPluginKF5 and
OverlayIconPluginKF6 both have `using namespace` directives, which
causes clang to fail due to -Werror=header-hygiene.
2024-09-15 11:48:28 -04:00
David Korth
6b48a743ab [cmake] Add flags for RelWithDebInfo.
On gcc, Release no longer enables debugging flags.

On MSVC, both Release and RelWithDebInfo have debugging flags because
MSVC uses PDBs by default.
2024-03-24 16:58:18 -04:00
David Korth
4ec1259f0c [cmake] gcc.cmake: Disable LDFLAGS checks if building with Emscripten.
Doing some tests just to see how far we can get with it...
2024-03-15 23:34:55 -04:00
David Korth
d8538ed6bb [cmake] gcc.cmake: Add some -Werror options from OpenSSF.
Reference: https://best.openssf.org/Compiler-Hardening-Guides/Compiler-Options-Hardening-Guide-for-C-and-C++.html

Flags added: (C only)
* -Werror=implicit
* -Werror=incompatible-pointer-types
* -Werror=int-conversion
2024-03-10 23:02:43 -04:00
David Korth
d638c4aa86 [cmake] gcc.cmake: Specify -fno-math-errno.
We don't need to check errno for any math functions, and this prevents
certain inlining optimizations. In particular, lrintf() can't be inlined
if we don't specify this, even though glibc's documentation says that
its lrintf() implementation doesn't set errno.

Assembly comparison of manual truncation vs. lrintf() with
-fno-math-errno:

amd64:
- Manual:   cvttss2si
- lrintf(): cvtss2si (note the single t)

i386 with SSE disabled:
- Manual:   fistp with control word manipulation
- lrintf(): fistp without control word manipulation

Presumably the control word on manipulation changes the rounding mode.
lrintf() without errno doesn't change the rounding mode and relies on
the default rounding, which matches amd64.

TODO: MSVC equivalent, if available.
2024-03-01 20:29:11 -05:00
David Korth
72238fb034 [cmake] Set -Werror=strict-aliasing to prevent strict aliasing errors.
[libromdata] Nintendo3DSFirm: Fix a strict aliasing error on Ubuntu 16.04. (gcc-5.4.0)

In file included from src/libromdata/stdafx.h:62:0,
                 from src/libromdata/Handheld/Nintendo3DSFirm.cpp:9:
src/libromdata/Handheld/Nintendo3DSFirm.cpp: In member function ‘virtual int LibRomData::Nintendo3DSFirm::loadFieldData()’:
src/libromdata/Handheld/Nintendo3DSFirm.cpp:369:97: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
   const uint32_t first4 = be32_to_cpu(*(reinterpret_cast<const uint32_t*>(firmHeader->signature)));
                                                                                                 ^
src/libromdata/../librpcpu/byteswap_rp.h:63:52: note: in definition of macro ‘__swab32’
 #  define __swab32(x) ((uint32_t)__builtin_bswap32(x))
                                                    ^
src/libromdata/Handheld/Nintendo3DSFirm.cpp:369:27: note: in expansion of macro ‘be32_to_cpu’
   const uint32_t first4 = be32_to_cpu(*(reinterpret_cast<const uint32_t*>(firmHeader->signature)));
                           ^
cc1plus: some warnings being treated as errors
2024-03-01 18:04:12 -05:00
David Korth
6ab2951d89 Use CMAKE_<LANG>_STANDARD instead of custom macros.
CMake 3.1 added CMAKE_<LANG>_STANDARD, which allows CMake to determine
what flags are needed to select a particular language version.

Set it to C17 and C++17. Previously, we were using C11 and C++11,
though gcc11 switched the default C++ version to C++17. The custom
macro handled this by not adding flags for C++, but it still added
the C11 flag, which prevented use of C17.

No code size differences were observed when compiling on gcc-13.2.0
with CMAKE_<LANG>_STANDARD.
2023-10-21 11:44:35 -04:00
David Korth
c47854506a [cmake] gcc.cmake: Enable -ftree-vectorize in release builds.
On i386, also add -mstackrealign, since i386 was originally defined to
use 4-byte stack alignment. Most programs *should* be updated to use
16-byte stack alignment nowadays, but just in case something isn't,
this will help to prevent alignment exceptions.
2023-08-07 18:04:26 -04:00
David Korth
66d0f4e8b8 [cmake] gcc.cmake: Remove "--no-undefined" and "--no-allow-shlib-undefined" from SHARED and MODULE linker flags on non-Linux systems.
On FreeBSD 13.2, `environ` and `__progname` are intentionally undefined,
so this *always* fails when building a shared library.
2023-08-04 23:59:42 -04:00
David Korth
bab1772d49 Don't allow enabling LTO at all if not using at least gcc-6.1.
The gcc-5 workaround stopped working properly due to some recent change.
I can't be bothered to figure out what broke it, and gcc-5 is rather old.

Just don't allow enabling LTO at all.

Removed the GCC_5xx_LTO_ISSUES workarounds in all CMakeLists files.

Reworked the -lgcc workaround to check the compiler version instead
of GCC_5xx_LTO_ISSUES.
2023-07-01 16:25:15 -04:00
David Korth
6c1021aa0a [cmake] gcc.cmake: Add coverage flags to the linker flags.
This lets us remove "-lgcov", since gcc will automatically add the
coverage library when linking with coverage.

NOTE: Remember to set LD_LIBRARY_PATH when testing code coverage.
Otherwise, the system-wide libromdata.so.2 will be tested, and
that won't have coverage instrumentation.
2023-02-11 10:19:54 -05:00
David Korth
61e57cbf73 Revert "[cmake] platform/gcc.cmake: Specify the gcov library as "gcov", not "-lgcov"."
Turns out CMake was *not* doing the right thing for us, and it was
failing to find the gcov target.

This reverts commit 6cfcf08f61.
2023-02-11 10:08:50 -05:00
David Korth
ecd93c837b Fix underlinking in the GTK UI frontends.
Add the following linker options:
- --no-undefined
- --no-allow-shlib-undefined

GTK UI frontends: Link to Pango, GDK, and other libraries directly if
we're using symbols from those libraries.

NOTE: CMake's FindGTK2 seems to do this already, but we'll add the extra
linking ourselves just in case.

This fixes errors similar to the following after adding the
linker options:

/usr/lib/gcc/x86_64-pc-linux-gnu/12.2.0/../../../../x86_64-pc-linux-gnu/bin/ld:
	src/gtk/gtk3/CMakeFiles/rom-properties-gtk3.dir/__/config/CacheTab.cpp.o:
	undefined reference to symbol 'gdk_window_set_cursor'
/usr/lib/gcc/x86_64-pc-linux-gnu/12.2.0/../../../../x86_64-pc-linux-gnu/bin/ld:
	/usr/lib64/libgdk-3.so.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
2022-09-17 13:32:45 -04:00
David Korth
18257fd2f5 [cmake] gcc.cmake: Reorder DT_RELR detection to show the status message before checking ld. 2022-08-06 02:06:10 -04:00
David Korth
7afa618c3b [cmake] gcc.cmake: No need to set SHARED and MODULE flags here. 2022-08-05 00:42:43 -04:00
David Korth
d732fbc010 [cmake] platform/gcc.cmake: Initial support for detecting DT_RELR.
Currently only supported if using glibc-2.36 and binutils-2.38.

TODO:
- Detect more systems with DT_RELR.
- Handle cross-compiling better?
2022-08-05 00:40:45 -04:00
David Korth
8feb4cb10f [cmake] gcc.cmake: Check for and use "-fcf-protection" if available. 2022-07-06 18:28:56 -04:00
David Korth
aea2d716f0 [cmake] gcc.cmake: Don't use -Wsuggest-override on gcc versions earlier than 9.2.
Earlier versions will warn if a function is marked 'final' but not
'override'.

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78010
2022-02-25 18:29:45 -05:00
David Korth
466b2787ad [cmake] gcc.cmake: Add "-Wno-error=suggest-override".
For some reason, "-Wsuggest-override" is being turned into an error in
the MinGW-w64 build. This breaks Google Test, which is apparently
triggering some "suggest override" warnings.
2022-02-23 19:50:50 -05:00
David Korth
ecc22c0699 [cmake] gcc.cmake: Enable "suggest override" if available. (C++ only) 2022-02-21 18:15:34 -05:00
David Korth
1d16c40449 Some minor MinGW-w64 improvements.
- Use host gettext executables when cross-compiling with MinGW.
- Change CHECK_GETTEXT() from a macro to a function.
- Disable -Wno-cast-function-type, since it prints warnings every time
  we use GetProcAddress().
2022-02-17 22:35:45 -05:00
David Korth
86dbf36f3e [cmake] gcc.cmake: Enable -Werror for several different format warnings.
Reference: https://fedoraproject.org/wiki/Format-Security-FAQ

-Werror=format-nonliteral is *not* enabled because there are some
legitimate uses of non-literal format strings.

Separated the warning flags into multiple variables.

Updated everything to build with this change.
2021-09-06 01:41:59 -04:00
David Korth
9a49d1d701 [cmake] platform/gcc.cmake: Use -Bsymbolic-functions if available.
KDE Frameworks 5.85.0 enables this by default. It reduces startup time
by pre-linking global function symbols.

Also, filter out '=' from variable names. This broke the caching of
-Werror=return-type.

msvc.cmake: Copy the '=' change here.
2021-08-14 10:05:05 -04:00
David Korth
6cfcf08f61 [cmake] platform/gcc.cmake: Specify the gcov library as "gcov", not "-lgcov".
Don't use compiler-specific library options. CMake will do the
"right thing" for us.
2021-08-12 23:51:57 -04:00
David Korth
b6ed9ce74c [cmake] gcc.cmake: Add "-Werror=return-type".
I'm not sure when this started happening, but leaving out a return
value from a non-void function is causing gcc to jump to a semi-random
function instead of simply returning an undefined value.

language_combo_box_set_selected_lc() was calling
language_combo_box_set_property() because of this:

.#4  0x00007fffca11e468 in language_combo_box_set_property(GObject*, guint, GValue const*, GParamSpec*) (object=0x7ffff70d0108, prop_id=1, value=0xa8, pspec=0x1)
     at ../../src/gtk/LanguageComboBox.cpp:156
.#5  0x0000555555cf3ad0 in  ()
.#6  0x000000000000656e in  ()
.#7  0x0000555555cf3ad0 in  ()
.#8  0x0000555555c46838 in  ()
.#9  0x0000555555e5b6a0 in  ()
.#10 0x00007fffca111d0b in rom_data_view_update_multi(RomDataView*, uint32_t) (page=page@entry=0x7fffe8020490 [RomDataView], user_lc=user_lc@entry=0)
     at ../../src/gtk/RomDataView.cpp:1554
2020-10-12 02:26:59 -04:00
David Korth
691d632098 [cmake] gcc.cmake: Undo accidentally-committed changes that disabled "-Og".
I set this while testing some refcounting stuff earlier.

This fixes a regression from commit 2b4ada24e4.
([librpbase] IconAnimData: Changed to a reference-counted class.)
2020-09-13 05:45:13 -04:00
David Korth
2b4ada24e4 [librpbase] IconAnimData: Changed to a reference-counted class.
Updated all RomData subclasses and UI frontends for this change.

Animated icons now work correctly in UI frontends after e.g. extracting
an SRL from a DSi TAD package or Nintendo 3DS CIA.
2020-09-12 22:00:55 -04:00
David Korth
74661171dc [cmake] gcc.cmake: Set -Werror=implicit-function-declaration.
Copied from rvthtool.
2020-06-20 13:55:18 -04:00
David Korth
f5a749c3f0 Use statx() on Linux systems where available.
Note that we don't need to implement runtime fallbacks to stat():

1. If statx() isn't available at compile time, stat() will be used
   regardless.

2. If glibc supports statx() but the kernel doesn't, glibc will
   emulate statx(). This might introduce some extra overhead, but
   it's easier to work with.

3. The BSDs keep their libc in sync with the kernel, so there's no
   possibility that libc will support statx() if the kernel doesn't.
2020-03-08 01:01:01 -05:00
David Korth
8d973bc089 [cmake] Use ADD_DEFINITIONS() for macros that are common to both debug and release builds.
This cleans up the language-specific flags a bit.
2020-02-22 11:38:25 -05:00
David Korth
3970bb1847 [cmake] gcc.cmake: ld "supports" --compress-debug-sections on NetBSD/OpenBSD, but it doesn't actually work.
Attempting to use the option results in an error at runtime:
ld: error: --compress-debug-sections: zlib is not available
2019-08-17 21:26:21 -04:00
David Korth
d9078ff921 [cmake] gcc.cmake: Check for "-O", but use "-O1" instead.
GNU ld treats these as the same, but clang ld requires a value to be
specified.

This fixes a regression on FreeBSD from commit 107224487f.
([cmake] Reworked --compress-debug-sections logic for compatibility with older systems.)
2019-08-14 01:12:03 -04:00
David Korth
107224487f [cmake] Reworked --compress-debug-sections logic for compatibility with older systems.
Ubuntu 14.04's ld (binutils-2.24) doesn't have --compress-debug-sections,
which causes travis-ci to fail.

cmake-3.6's try_compile() attempts to build an executable by default,
which *should* test the linker flags, but that isn't working, either.
Ubuntu 14.04 has cmake-3.3, so that wouldn't help anyway.

Instead, check the output of `ld --help` for the various options.
This seems to work for the most part.

Enabled this method for Mac OS X as well.

If the --compress-debug-sections=zlib linker test fails, then we'll
fall back to the old objcopy method. SplitDebugInformation.cmake uses
the same detection method to check if objcopy supports the option,
and if it does, it uses it.
2019-08-12 23:22:59 -04:00