View Issue Details

IDProjectCategoryView StatusLast Update
0000189Gameplay + OpenGL[All Projects] Bugpublic2017-02-05 15:25
ReporterEdward-san 
Assigned ToGraf Zahl 
PrioritynormalSeveritymajorReproducibilityalways
Status resolvedResolutionfixed 
Summary0000189: GCC 6 compile error - ParseDrawTextureTags
DescriptionIt happens only with GCC version 6.


/home/edward-san/zdoom/gzdoom/trunk/src/v_draw.cpp: In member function ‘void DCanvas::DrawTexture(FTexture*, 
double, double, int, ...)’:
/home/edward-san/zdoom/gzdoom/trunk/src/v_draw.cpp:136:76: error: no matching function for call to ‘DCanvas::ParseDrawTextureTags(FTexture*&, 
double&, double&, int&, va_list, DrawParms*, bool)’
  bool res = ParseDrawTextureTags(img, x, y, tags_first, tags, &parms, false);
                                                                            ^
In file included from /home/edward-san/zdoom/gzdoom/trunk/src/v_draw.cpp:41:0:
/home/edward-san/zdoom/gzdoom/trunk/src/v_video.h:287:7: note: candidate: bool DCanvas::ParseDrawTextureTags(FTexture*, 
double, double, DWORD, T&, DrawParms*, bool) const [with T = __va_list_tag [1]; DWORD = unsigned 
int]
  bool ParseDrawTextureTags(FTexture *img, double x, double y, DWORD tag, T& tags, DrawParms *parms, 
bool fortext) const;
       ^~~~~~~~~~~~~~~~~~~~
/home/edward-san/zdoom/gzdoom/trunk/src/v_video.h:287:7: note:   no known conversion for argument 5 from 
‘va_list {aka __va_list_tag [1]}’ to ‘__va_list_tag (&)[1]’
/home/edward-san/zdoom/gzdoom/trunk/src/v_draw.cpp: At global scope:
/home/edward-san/zdoom/gzdoom/trunk/src/v_draw.cpp:949:15: error: template-id ‘ParseDrawTextureTags<va_list>’ 
for ‘bool DCanvas::ParseDrawTextureTags(FTexture*, double, double, DWORD, __va_list_tag (&)[1], 
DrawParms*, bool) const’ does not match any template declaration
 template bool DCanvas::ParseDrawTextureTags<va_list>(FTexture *img, double x, double y, DWORD 
tag, va_list& tags, DrawParms *parms, bool fortext) const;
               ^~~~~~~
In file included from /home/edward-san/zdoom/gzdoom/trunk/src/v_draw.cpp:41:0:
/home/edward-san/zdoom/gzdoom/trunk/src/v_video.h:287:7: note: candidate is: template<class T> 
bool DCanvas::ParseDrawTextureTags(FTexture*, double, double, DWORD, T&, DrawParms*, bool) const
  
bool ParseDrawTextureTags(FTexture *img, double x, double y, DWORD tag, T& tags, DrawParms *parms, 
bool fortext) const;
       ^~~~~~~~~~~~~~~~~~~~



/home/edward-san/zdoom/gzdoom/trunk/src/v_text.cpp: In member function ‘void DCanvas::DrawChar(FFont*, 
int, double, double, int, int, ...)’:
/home/edward-san/zdoom/gzdoom/trunk/src/v_text.cpp:71:76: error: no matching function for call to ‘DCanvas::ParseDrawTextureTags(FTexture*&, 
double&, double&, int&, va_list, DrawParms*, bool)’
   bool res = ParseDrawTextureTags(pic, x, y, tag_first, tags, &parms, false);
                                                                            ^
In file included from /home/edward-san/zdoom/gzdoom/trunk/src/v_text.cpp:42:0:
/home/edward-san/zdoom/gzdoom/trunk/src/v_video.h:287:7: note: candidate: bool DCanvas::ParseDrawTextureTags(FTexture*, 
double, double, DWORD, T&, DrawParms*, bool) const [with T = __va_list_tag [1]; DWORD = unsigned 
int]
  bool ParseDrawTextureTags(FTexture *img, double x, double y, DWORD tag, T& tags, DrawParms *parms, 
bool fortext) const;
       ^~~~~~~~~~~~~~~~~~~~
/home/edward-san/zdoom/gzdoom/trunk/src/v_video.h:287:7: note:   no known conversion for argument 5 from 
‘va_list {aka __va_list_tag [1]}’ to ‘__va_list_tag (&)[1]’
/home/edward-san/zdoom/gzdoom/trunk/src/v_text.cpp: In member function ‘void DCanvas::DrawText(FFont*, 
int, int, int, const char*, int, ...)’:
/home/edward-san/zdoom/gzdoom/trunk/src/v_text.cpp:106:78: error: no matching function for call to ‘DCanvas::ParseDrawTextureTags(std::nullptr_t, 
int, int, int&, va_list, DrawParms*, bool)’
  bool res = ParseDrawTextureTags(nullptr, 0, 0, tag_first, tags, &parms, true);
                                                                              ^
In file included from /home/edward-san/zdoom/gzdoom/trunk/src/v_text.cpp:42:0:
/home/edward-san/zdoom/gzdoom/trunk/src/v_video.h:287:7: note: candidate: bool DCanvas::ParseDrawTextureTags(FTexture*, 
double, double, DWORD, T&, DrawParms*, bool) const [with T = __va_list_tag [1]; DWORD = unsigned 
int]
  bool ParseDrawTextureTags(FTexture *img, double x, double y, DWORD tag, T& tags, DrawParms *parms, 
bool fortext) const;
       ^~~~~~~~~~~~~~~~~~~~
/home/edward-san/zdoom/gzdoom/trunk/src/v_video.h:287:7: note:   no known conversion for argument 5 from 
‘va_list {aka __va_list_tag [1]}’ to ‘__va_list_tag (&)[1]’
TagsNo tags attached.

Relationships

Activities

_mental_

_mental_

2017-02-05 07:31

developer   ~0000384

Last edited: 2017-02-05 07:49

View 2 revisions

Will it work if tags will be passed by value, like in this commit?

This fixes compilation errors with GCC 6.3 but because of unrelated problems I cannot test it at runtime.

Graf Zahl

Graf Zahl

2017-02-05 10:04

administrator   ~0000385

I seriously have to wonder here: What were those idiots smoking when they made va_list an array? This breaks so much code it's almost unbelievable.

Is there any sane way to pass this to a function without some compiler getting the hiccups?

As it stands, some systems need a pass by reference, others need a pass by value so what to do?
_mental_

_mental_

2017-02-05 11:09

developer   ~0000388

Pass by value works in Clang too. I didn't try in MSVC yet but it should work everywhere.
Graf Zahl

Graf Zahl

2017-02-05 11:26

administrator   ~0000391

It originally was pass by value until you changed it.
_mental_

_mental_

2017-02-05 11:30

developer   ~0000392

No, it was in mixed form but va_list value could not be bound to a reference.
Edward-san

Edward-san

2017-02-05 11:40

developer   ~0000393

Yeah, that seems to work with GCC 6.
_mental_

_mental_

2017-02-05 11:48

developer   ~0000394

Last edited: 2017-02-05 11:48

View 2 revisions

I think I was wrong when changed tags param of this function to reference type.
Most likely all other usages of va_list should be changed to values instead.
This need some testing though.

Edward-san

Edward-san

2017-02-05 11:51

developer   ~0000395

Right, sorry, I didn't check that actually it fails at linking time.
_mental_

_mental_

2017-02-05 13:47

developer   ~0000397

Anyway it's impossible to use values everywhere because bunch of functions modifies their parameter.
Googling the problem revealed that only a pointer to va_list is portable way to do this.
_mental_

_mental_

2017-02-05 14:42

developer   ~0000399

Edward-san, could you please try this commit with GCC 6?
Graf Zahl

Graf Zahl

2017-02-05 14:45

administrator   ~0000401

By now I believe that the only safe way is to put the va_list into a struct and pass references to that around.
Graf Zahl

Graf Zahl

2017-02-05 14:54

administrator   ~0000402

If you can confirm that my last commit works, feel free to close this report.
Edward-san

Edward-san

2017-02-05 15:24

developer   ~0000403

Yeah, it works now.

Issue History

Date Modified Username Field Change
2017-02-05 06:49 Edward-san New Issue
2017-02-05 07:31 _mental_ Note Added: 0000384
2017-02-05 07:49 _mental_ Note Edited: 0000384 View Revisions
2017-02-05 10:04 Graf Zahl Note Added: 0000385
2017-02-05 10:04 Graf Zahl Assigned To => Edward-san
2017-02-05 10:04 Graf Zahl Status new => assigned
2017-02-05 11:09 _mental_ Note Added: 0000388
2017-02-05 11:26 Graf Zahl Note Added: 0000391
2017-02-05 11:30 _mental_ Note Added: 0000392
2017-02-05 11:40 Edward-san Note Added: 0000393
2017-02-05 11:48 _mental_ Note Added: 0000394
2017-02-05 11:48 _mental_ Note Edited: 0000394 View Revisions
2017-02-05 11:51 Edward-san Note Added: 0000395
2017-02-05 13:47 _mental_ Note Added: 0000397
2017-02-05 14:42 _mental_ Note Added: 0000399
2017-02-05 14:45 Graf Zahl Note Added: 0000401
2017-02-05 14:54 Graf Zahl Note Added: 0000402
2017-02-05 15:24 Edward-san Status assigned => resolved
2017-02-05 15:24 Edward-san Resolution open => fixed
2017-02-05 15:24 Edward-san Note Added: 0000403
2017-02-05 15:25 Edward-san Assigned To Edward-san => Graf Zahl