[Scummvm-git-logs] scummvm master -> 246a0629504c2fbd3c2213da4f65e362dc5bcc36

bluegr noreply at scummvm.org
Wed Oct 26 23:26:06 UTC 2022


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
246a062950 CONFIGURE/CREATE_PROJECT: Silence address-of-packed-member GCC 12 warning


Commit: 246a0629504c2fbd3c2213da4f65e362dc5bcc36
    https://github.com/scummvm/scummvm/commit/246a0629504c2fbd3c2213da4f65e362dc5bcc36
Author: Orgad Shaneh (orgads at gmail.com)
Date: 2022-10-27T02:26:02+03:00

Commit Message:
CONFIGURE/CREATE_PROJECT: Silence address-of-packed-member GCC 12 warning

It appears a lot, and these casts are intentional and look safe.

Example:
../scummvm/engines/glk/alan3/actor.cpp: In function 'Glk::Alan3::ScriptEntry* Glk::Alan3::scriptOf(int)':
../scummvm/engines/glk/alan3/lists.h:35:52: warning: converting a packed 'Glk::Alan3::ScriptEntry' pointer (alignment 1) to a 'Glk::Alan3::Aword' {aka 'unsigned int'} pointer (alignment 4) may result in an unaligned pointer value [-Waddress-of-packed-member]
   35 | #define isEndOfArray(x) implementationOfIsEndOfList((Aword *) (x))
      |                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
../scummvm/engines/glk/alan3/actor.cpp:38:84: note: in expansion of macro 'isEndOfArray'
   38 |                 for (scr = (ScriptEntry *) pointerTo(header->scriptTableAddress); !isEndOfArray(scr); scr++)
      |                                                                                    ^~~~~~~~~~~~
In file included from ../scummvm/engines/glk/alan3/actor.h:25,
                 from ../scummvm/engines/glk/alan3/actor.cpp:22:
../scummvm/engines/glk/alan3/acode.h:453:8: note: defined here
  453 | struct ScriptEntry {    /* SCRIPT TABLE */
      |        ^~~~~~~~~~~

Changed paths:
    configure
    devtools/create_project/cmake.cpp


diff --git a/configure b/configure
index 0c3cdde3e82..dcfc3c28692 100755
--- a/configure
+++ b/configure
@@ -2308,6 +2308,8 @@ set_flag_if_supported -Wno-undefined-var-template
 # macros.
 set_flag_if_supported -Wno-pragma-pack
 
+set_flag_if_supported -Wno-address-of-packed-member
+
 if test -n "$STRINGS"; then
 	_strings=$STRINGS
 else
diff --git a/devtools/create_project/cmake.cpp b/devtools/create_project/cmake.cpp
index 806992d29ff..969136b99ab 100644
--- a/devtools/create_project/cmake.cpp
+++ b/devtools/create_project/cmake.cpp
@@ -330,6 +330,9 @@ void CMakeProvider::writeWarnings(std::ofstream &output) const {
 		output << ' ' << warning;
 	}
 	output << "\")\n";
+	output << "\tif(CMAKE_CXX_COMPILER_ID STREQUAL \"GNU\" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 11.0)\n";
+	output << "\t\tset(CMAKE_CXX_FLAGS \"${CMAKE_CXX_FLAGS} -Wno-address-of-packed-member\")\n";
+	output << "\tendif()\n";
 	output << "endif()\n";
 }
 




More information about the Scummvm-git-logs mailing list