MantisBT - Doomseeker
View Issue Details
0003820Doomseeker[All Projects] Bugpublic2020-06-07 08:052020-06-08 13:54
WubTheCaptain 
Zalewa 
lowminorhave not tried
resolvedfixed 
1.3.1 
1.41.4 
0003820: src/core/scanner.cpp uses <cstdarg> macros without including the header
Somehow magically, src/core/scanner.cpp compiles on my machine (when it shouldn't) without #include <cstdarg>.
$ grep "va_" src/core/scanner.{cpp,h} | wc -l
6
$ grep "<cstdarg>" src/core/scanner.{cpp,h} | wc -l
0
$ grep "stdarg.h" src/core/scanner.{cpp,h} | wc -l
0

Quote from src/core/scanner.cpp
#include <cmath>
#include <cstdio>
#include <cstdlib>
No tags attached.
patch 0001-Scanner-scriptMessage-Add-missing-cstdarg-header.patch (940) 2020-06-07 18:32
https://zandronum.com/tracker/file_download.php?file_id=2608&type=bug
patch 0002-scanner.h-Include-the-missing-cstdarg-header.patch (724) 2020-06-08 05:53
https://zandronum.com/tracker/file_download.php?file_id=2609&type=bug
Issue History
2020-06-07 08:05WubTheCaptainNew Issue
2020-06-07 08:11WubTheCaptainNote Added: 0021369
2020-06-07 18:32WubTheCaptainFile Added: 0001-Scanner-scriptMessage-Add-missing-cstdarg-header.patch
2020-06-07 18:32WubTheCaptainAssigned To => WubTheCaptain
2020-06-07 18:32WubTheCaptainStatusnew => needs review
2020-06-07 18:33WubTheCaptainTarget Version => 1.4
2020-06-08 02:07Blzut3Note Added: 0021412
2020-06-08 05:48WubTheCaptainStatusneeds review => assigned
2020-06-08 05:53WubTheCaptainFile Added: 0002-scanner.h-Include-the-missing-cstdarg-header.patch
2020-06-08 05:54WubTheCaptainNote Added: 0021424
2020-06-08 05:54WubTheCaptainStatusassigned => needs review
2020-06-08 05:54WubTheCaptainAssigned ToWubTheCaptain => Blzut3
2020-06-08 11:53ZalewaNote Added: 0021429
2020-06-08 13:54WubTheCaptainStatusneeds review => resolved
2020-06-08 13:54WubTheCaptainFixed in Version => 1.4
2020-06-08 13:54WubTheCaptainResolutionopen => fixed
2020-06-08 13:54WubTheCaptainAssigned ToBlzut3 => Zalewa

Notes
(0021369)
WubTheCaptain   
2020-06-07 08:11   
It may be because src/core/plugins/engineplugin.cpp includes <cstdarg> and CMake compiles the whole project, thus it ends up linking that way.
(0021412)
Blzut3   
2020-06-08 02:07   
scanner.h references va_list so wouldn't this also be technically needed there as well?

It links because it's part of the standard library so hard for it not to link. As for why it compiles, one of the other headers must include it. stdarg is common enough that it's not uncommon for the lack of the include to go unnoticed.
(0021424)
WubTheCaptain   
2020-06-08 05:54   
Good catch!

I could use <cstdarg> in only scanner.h, but I think this... makes more sense. Patch attached.
(0021429)
Zalewa   
2020-06-08 11:53   
I merged the 2nd patch only as this should be sufficient:
https://bitbucket.org/Doomseeker/doomseeker/commits/20a745b11ce1721b709eaa6ba5943ff0f123f85c [^]