Skip to content

games/NXDoom: drop the assignments left over from dehacked - #3695

Merged
xiaoxiang781216 merged 1 commit into
apache:masterfrom
JorgeGzm:fix/nxdoom-self-assign
Aug 4, 2026
Merged

games/NXDoom: drop the assignments left over from dehacked#3695
xiaoxiang781216 merged 1 commit into
apache:masterfrom
JorgeGzm:fix/nxdoom-self-assign

Conversation

@JorgeGzm

@JorgeGzm JorgeGzm commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Summary

Six statements in the NXDoom sources assign a variable to itself, which clang
rejects:

src/doom/f_finale.c:637:16: error: explicitly assigning value of variable of
type 'const char *' to itself [-Werror,-Wself-assign]
  637 |       lumpname = (lumpname);
      |       ~~~~~~~~ ^  ~~~~~~~~

Chocolate DOOM wraps those strings in DEH_String() so that a dehacked patch
can substitute them. The port has no dehacked support and the macro went away
with it, leaving the bare parentheses behind. This removes the six leftover
assignments, plus two comments that only described the substitution:

  • games/NXDoom/src/doom/f_finale.c: lumpname, finaletext, finaleflat
  • games/NXDoom/src/doom/g_game.c: skytexturename (two sites)
  • games/NXDoom/src/doom/hu_stuff.c: s

Impact

Build only, and only for configurations compiled with clang. GCC does not warn
about self-assignment, so the configurations built so far never noticed it;
clang does, and the build fails because the CI passes -Werror
(tools/ci/cibuild.sh: -e "-Wno-cpp -Werror"). The nxdoom configurations are
sim:nxdoom, linum-stm32h753bi:nxdoom and raspberrypi-4b:nxdoom.

No functional change: the removed statements are no-ops. They were not entirely
free, though -- the nxdoom configurations build with CONFIG_DEBUG_NOOPT=y, so
the redundant stores were actually emitted, and the image loses 16 bytes of
text (see the sizes below). No change to the API, configuration, build system
or documentation.

Testing

Host: Ubuntu 24.04.4 LTS, x86_64, Linux 7.0.0-28-generic

  • clang 18.1.3, LLVM binutils 18 (CONFIG_ARM_TOOLCHAIN_CLANG=y)
  • arm-none-eabi-gcc 13.2.1 (Arm GNU Toolchain 13.2.rel1)

Target: arm, linum-stm32h753bi:nxdoom

Both builds use the same warning flags the CI uses:
make EXTRAFLAGS="-Wno-cpp -Werror".

Before, clang

$ make -k -j EXTRAFLAGS="-Wno-cpp -Werror"
src/doom/f_finale.c:637:16: error: explicitly assigning value of variable of type 'const char *' to itself [-Werror,-Wself-assign]
  637 |       lumpname = (lumpname);
      |       ~~~~~~~~ ^  ~~~~~~~~
src/doom/f_finale.c:693:14: error: explicitly assigning value of variable of type 'const char *' to itself [-Werror,-Wself-assign]
  693 |   finaletext = (finaletext);
      |   ~~~~~~~~~~ ^  ~~~~~~~~~~
src/doom/f_finale.c:694:14: error: explicitly assigning value of variable of type 'const char *' to itself [-Werror,-Wself-assign]
  694 |   finaleflat = (finaleflat);
      |   ~~~~~~~~~~ ^  ~~~~~~~~~~
src/doom/hu_stuff.c:386:5: error: explicitly assigning value of variable of type 'const char *' to itself [-Werror,-Wself-assign]
src/doom/g_game.c:445:22: error: explicitly assigning value of variable of type 'const char *' to itself [-Werror,-Wself-assign]
src/doom/g_game.c:2288:22: error: explicitly assigning value of variable of type 'const char *' to itself [-Werror,-Wself-assign]
make[2]: *** [apps/Application.mk:264: src/doom/f_finale.c...o] Error 1

After, clang

Compiles with no warnings and no errors.

After, arm-none-eabi-gcc 13.2.1

$ make -j EXTRAFLAGS="-Wno-cpp -Werror"
$ arm-none-eabi-size nuttx
   text	   data	    bss	    dec	    hex	filename
 616070	  42876	 262656	 921602	  e1002	nuttx

Same configuration before the change, for comparison:

   text	   data	    bss	    dec	    hex	filename
 616086	  42876	 262656	 921618	  e1012	nuttx

data and bss are unchanged; text drops the 16 bytes of the redundant
stores.

Runtime

The resulting image was flashed on a LINUM-STM32H753BI over ST-LINK-V3 and
nxdoom was run from the NSH prompt: the game starts and plays exactly as it did
before the change, as expected for statements that had no effect.

Six statements assign a variable to itself, which clang rejects:

  src/doom/f_finale.c:637:16: error: explicitly assigning value of
  variable of type 'const char *' to itself [-Werror,-Wself-assign]
    637 |       lumpname = (lumpname);

Chocolate DOOM wraps those strings in DEH_String() so that a dehacked
patch can substitute them. The port has no dehacked support, and the
macro went away with it, leaving the parentheses behind. Two comments
that only described the substitution go as well.

Nothing changes at run time. GCC does not warn about this, so the
configurations built so far never noticed; the ones built with clang
do, and they fail because the CI treats warnings as errors.

Signed-off-by: Jorge Guzman <jorge.gzm@gmail.com>

@cederom cederom left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @JorgeGzm :-)

@cederom
cederom requested a review from acassis August 4, 2026 00:32
@xiaoxiang781216
xiaoxiang781216 merged commit 5a73a6f into apache:master Aug 4, 2026
41 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants