Menu

Syntax error in sounds.c

2025-03-07
2025-03-07
  • Michael Bäuerle

    Tested with SVN r1733 and GCC 10.5 on NetBSD 10:

    sounds.c: In function 'remap_sound':
    sounds.c:942:5: error: a label can only be part of a statement and a declaration is not a statement
      942 |     sfxinfo_t * refinfo = & sfx_extensions[sfx_extension_id];
          |     ^~~~~~~~~
    gmake[1]: *** [Makefile:1542: ../objs/sounds.o] Error 1
    

    Wrapping the declaration and code as a block works (formerly the scope of refinfo has ended with the return):

    [...]
    
    remap_within_block:
        {
            sfxinfo_t * refinfo = & sfx_extensions[sfx_extension_id];
            store_sfx( sfxid, name_p, refinfo, refinfo->flags );
            if( verbose )
                GenPrintf(EMSG_info, "Sfx %i: mapped to %i\n", wad_sfx_index, sfxid );
        }
    
    remap_done:
        return sfxid;
    }
    
     
  • Wesley Johnson

    Wesley Johnson - 2025-03-07

    That comes from editing the code 50 times, moving stuff around.
    Do not know why GCC 12 did not complain about that, it usually does, it has done so before for very similar code.
    Will put that fix into the next patch, which will be tuning the slow_react. I was just working on it.

    Thank you for testing and noticing this, before we got to release.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.