chocolate-doom icon indicating copy to clipboard operation
chocolate-doom copied to clipboard

Clang 15 doesn't like heretic and hexen code

Open turol opened this issue 3 years ago • 3 comments

Background

Version of Chocolate Doom: git master

Operating System and version: Any

Game: Heretic/Hexen

Bug description

Clang 15 is releasing shortly and it doesn't like heretic and hexen:

src/heretic/p_mobj.c:76:19: error: passing arguments to a function without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype] This is the code: https://github.com/chocolate-doom/chocolate-doom/blob/e49be7669f9072e2e27e67e29c097591a83bbf06/src/heretic/p_mobj.c#L76

And action is declared here: https://github.com/chocolate-doom/chocolate-doom/blob/e49be7669f9072e2e27e67e29c097591a83bbf06/src/heretic/info.h#L1371 It has no declared parameters and it's not possible to just add one because it's also called with two (different) parameters here: https://github.com/chocolate-doom/chocolate-doom/blob/e49be7669f9072e2e27e67e29c097591a83bbf06/src/heretic/p_pspr.c#L342

This is not the only one, full list of errors:

src/hexen/p_tick.c:104:41: error: passing arguments to a function without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype]

src/hexen/p_mobj.c:106:19: error: passing arguments to a function without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype]

src/hexen/p_pspr.c:248:26: error: passing arguments to a function without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype]

src/hexen/sv_save.c:2833:32: error: passing arguments to a function without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype]

src/hexen/sv_save.c:2862:31: error: passing arguments to a function without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype]

src/hexen/sv_save.c:2866:38: error: passing arguments to a function without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype]

src/heretic/p_tick.c:128:41: error: passing arguments to a function without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype]

src/heretic/p_pspr.c:342:26: error: passing arguments to a function without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype]

turol avatar Aug 13 '22 13:08 turol

I guess we'll have to go back to this "experimental stuff": https://github.com/chocolate-doom/chocolate-doom/blob/e49be7669f9072e2e27e67e29c097591a83bbf06/src/doom/d_think.h#L29-L45

It has also been removed in Boom/MBF.

rfomin avatar Aug 14 '22 09:08 rfomin

Or we can go the always-three-arguments route that I have chosen for Crispy back then (though for different reasons):

https://github.com/fabiangreffrath/crispy-doom/commit/370c8443c9146e00a7f802cf40c705ec31c9cea2

fabiangreffrath avatar Aug 14 '22 11:08 fabiangreffrath

I think always having three (or maybe two?) parameters sounds like the best way for me. The downside is that a lot of functions need updating. The crispy-doom commit seems to be about doom while this is in heretic/hexen.

turol avatar Aug 15 '22 11:08 turol