Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

g++ warnings - #8

Open
smoe opened this issue Aug 9, 2020 · 1 comment
Open

g++ warnings - #8

smoe opened this issue Aug 9, 2020 · 1 comment

Comments

@smoe
Copy link
Contributor

smoe commented Aug 9, 2020

Hello,

Admittedly, I do not see any immediate need to address any of these warnings.

Kind regards,
Steffen

$ gcc --version
gcc (Debian 10.2.0-3) 10.2.0
libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I. -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -fdebug-prefix-map=/home/moeller/git/med-team/libgclib=. -fstack-protector-strong -Wformat -Werror=format-security -Wall -pedantic -flto -fPIC -D_FILE_OFFSET_BITS=64 -c GStr.cpp  -fPIC -DPIC -o .libs/libgclib_la-GStr.o
In file included from gff.cpp:1:
gff.h:229:13: warning: ISO C++ prohibits anonymous structs [-Wpedantic]
  229 |      struct {
      |             ^
gff.h:232:13: warning: ISO C++ prohibits anonymous structs [-Wpedantic]
  232 |      struct {
      |             ^
gff.h:328:12: warning: ISO C++ prohibits anonymous structs [-Wpedantic]
  328 |     struct {
      |            ^
gff.h:691:14: warning: ISO C++ prohibits anonymous structs [-Wpedantic]
  691 |       struct {
      |              ^
gff.h:1150:12: warning: ISO C++ prohibits anonymous structs [-Wpedantic]
 1150 |     struct {
      |            ^
In file included from GList.hh:8,
                 from GFastaIndex.h:12,
                 from GFaSeqGet.h:3,
                 from gff.h:9,
                 from gff.cpp:1:
GVec.hh: In instantiation of ‘void GVec<OBJ>::setCapacity(int) [with OBJ = GMapSeg]’:
GVec.hh:202:3:   required from ‘GVec<OBJ>::GVec(int) [with OBJ = GMapSeg]’
gff.h:127:50:   required from here
GVec.hh:291:15: warning: ‘void* memset(void*, int, size_t)’ clearing an object of non-trivial type ‘class GMapSeg’; use assignment or value-initialization instead [-Wclass-memaccess]
  291 |         memset(fArray+fCount, 0, (NewCapacity-fCount)*sizeof(OBJ));
      |         ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from gff.cpp:1:
gff.h:70:7: note: ‘class GMapSeg’ declared here
   70 | class GMapSeg:public GSeg {
      |       ^~~~~~~
In file included from GList.hh:8,
                 from GFastaIndex.h:12,
                 from GFaSeqGet.h:3,
                 from gff.h:9,
                 from gff.cpp:1:
GVec.hh: In instantiation of ‘void GVec<OBJ>::setCapacity(int) [with OBJ = GSeg]’:
GVec.hh:202:3:   required from ‘GVec<OBJ>::GVec(int) [with OBJ = GSeg]’
gff.h:311:92:   required from here
GVec.hh:291:15: warning: ‘void* memset(void*, int, size_t)’ clearing an object of non-trivial type ‘class GSeg’; use assignment or value-initialization instead [-Wclass-memaccess]
  291 |         memset(fArray+fCount, 0, (NewCapacity-fCount)*sizeof(OBJ));
      |         ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from gff.h:6,
                 from gff.cpp:1:
GBase.h:308:7: note: ‘class GSeg’ declared here
  308 | class GSeg {
      |       ^~~~
In file included from GList.hh:8,
                 from GFastaIndex.h:12,
                 from GFaSeqGet.h:3,
                 from gff.h:9,
                 from gff.cpp:1:
GVec.hh: In instantiation of ‘void GVec<OBJ>::setCapacity(int) [with OBJ = GeneCDS]’:
GVec.hh:202:3:   required from ‘GVec<OBJ>::GVec(int) [with OBJ = GeneCDS]’
gff.h:1351:31:   required from here
GVec.hh:291:15: warning: ‘void* memset(void*, int, size_t)’ clearing an object of non-trivial type ‘class GeneCDS’; use assignment or value-initialization instead [-Wclass-memaccess]
  291 |         memset(fArray+fCount, 0, (NewCapacity-fCount)*sizeof(OBJ));
      |         ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from gff.cpp:1:
gff.h:1340:7: note: ‘class GeneCDS’ declared here
 1340 | class GeneCDS: public GSeg {
      |       ^~~~~~~
In file included from GList.hh:8,
                 from GFastaIndex.h:12,
                 from GFaSeqGet.h:3,
                 from gff.h:9,
                 from gff.cpp:1:
GVec.hh: In instantiation of ‘void GVec<OBJ>::setCapacity(int) [with OBJ = GffExon]’:
GVec.hh:202:3:   required from ‘GVec<OBJ>::GVec(int) [with OBJ = GffExon]’
gff.cpp:2315:16:   required from here
GVec.hh:291:15: warning: ‘void* memset(void*, int, size_t)’ clearing an object of non-trivial type ‘class GffExon’; use assignment or value-initialization instead [-Wclass-memaccess]
  291 |         memset(fArray+fCount, 0, (NewCapacity-fCount)*sizeof(OBJ));
      |         ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from gff.cpp:1:
gff.h:629:7: note: ‘class GffExon’ declared here
  629 | class GffExon : public GSeg {
      |       ^~~~~~~
In file included from GList.hh:8,
                 from GFastaIndex.h:12,
                 from GFaSeqGet.h:3,
                 from gff.h:9,
                 from gff.cpp:1:
GVec.hh: In instantiation of ‘void GVec<OBJ>::setCapacity(int) [with OBJ = GSegMatch]’:
GVec.hh:202:3:   required from ‘GVec<OBJ>::GVec(int) [with OBJ = GSegMatch]’
GList.hh:191:76:   required from ‘GArray<OBJ>::GArray(int (*)(pointer, pointer)) [with OBJ = GSegMatch; GCompareProc = int(void*, void*); pointer = void*]’
gff.h:1351:31:   required from here
GVec.hh:291:15: warning: ‘void* memset(void*, int, size_t)’ clearing an object of non-trivial type ‘class GSegMatch’; use assignment or value-initialization instead [-Wclass-memaccess]
  291 |         memset(fArray+fCount, 0, (NewCapacity-fCount)*sizeof(OBJ));
      |         ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from gff.cpp:1:
gff.h:1328:7: note: ‘class GSegMatch’ declared here
 1328 | class GSegMatch { //keep track of "matching" overlaps of a GeneCDSChain with multiple GeneSegment containers
      |       ^~~~~~~~~
In file included from GList.hh:8,
                 from GFastaIndex.h:12,
                 from GFaSeqGet.h:3,
                 from gff.h:9,
                 from gff.cpp:1:
GVec.hh: In instantiation of ‘void GVec<OBJ>::Grow(int, OBJ&) [with OBJ = GSegMatch]’:
GVec.hh:437:9:   required from ‘void GVec<OBJ>::Insert(int, OBJ*) [with OBJ = GSegMatch]’
GVec.hh:69:44:   required from ‘void GVec<OBJ>::Insert(int, OBJ) [with OBJ = GSegMatch]’
GList.hh:234:21:   required from ‘int GArray<OBJ>::Add(OBJ*) [with OBJ = GSegMatch]’
GList.hh:51:36:   required from ‘int GArray<OBJ>::Add(OBJ&) [with OBJ = GSegMatch]’
gff.h:1364:22:   required from here
GVec.hh:358:15: warning: ‘void* memset(void*, int, size_t)’ clearing an object of non-trivial type ‘class GSegMatch’; use assignment or value-initialization instead [-Wclass-memaccess]
  358 |         memset(&newList[fCount+1], 0, (NewCapacity-fCount-1)*sizeof(OBJ));
      |         ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from gff.cpp:1:
gff.h:1328:7: note: ‘class GSegMatch’ declared here
 1328 | class GSegMatch { //keep track of "matching" overlaps of a GeneCDSChain with multiple GeneSegment containers
      |       ^~~~~~~~~
@gpertea
Copy link
Owner

gpertea commented Aug 9, 2020

Thank you for pointing these out, had no idea ISO C++ is denying the convenience of anonymous structs. It's not that hard to adjust the code to fix it and I'll do it, just seems unnecessarily limiting.

The memset thing puzzles me, I saw it flagged before when using sanitizers but I cannot yet figure out why the compiler doesn't see that's conditional code there (template based), memset should only be called for the primitive types I am allowing there, yet somehow I keep getting that warning for GSeg. I have to dig a bit deeper there -- thank you for compiling this on such a new compiler to expose these issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants