[GRASS-dev] [GRASS GIS] #1533: mm.cc fails to build with GCC 4.7

#1533: mm.cc fails to build with GCC 4.7
-------------------------+--------------------------------------------------
Reporter: volter | Owner: grass-dev@…
     Type: defect | Status: new
Priority: major | Milestone: 6.4.2
Component: Compiling | Version: 6.4.1
Keywords: | Platform: Unspecified
      Cpu: Unspecified |
-------------------------+--------------------------------------------------
{{{
mm.cc: In function 'void* operator new (size_t)':
mm.cc:259:32: error: declaration of 'void* operator new (size_t)' has a
different exception specifier
In file included from mm.cc:29:0:
/builddir/build/BUILD/grass-6.4.1/dist.x86_64-redhat-linux-
gnu/include/grass/iostream/mm.h:114:17: error: from previous declaration
'void* operator new (std::size_t) throw (std::bad_alloc)'
mm.cc: In function 'void* operator new(size_t)':
mm.cc:310:30: error: declaration of 'void* operator new(size_t)' has a
different exception specifier
In file included from mm.cc:29:0:
/builddir/build/BUILD/grass-6.4.1/dist.x86_64-redhat-linux-
gnu/include/grass/iostream/mm.h:113:17: error: from previous declaration
'void* operator new(std::size_t) throw (std::bad_alloc)'
mm.cc: In function 'void operator delete(void*)':
mm.cc:362:32: error: declaration of 'void operator delete(void*)' has a
different exception specifier
In file included from mm.cc:29:0:
/builddir/build/BUILD/grass-6.4.1/dist.x86_64-redhat-linux-
gnu/include/grass/iostream/mm.h:115:15: error: from previous declaration
'void operator delete(void*) throw ()'
mm.cc: In function 'void operator delete (void*)':
mm.cc:402:34: error: declaration of 'void operator delete (void*)' has a
different exception specifier
In file included from mm.cc:29:0:
/builddir/build/BUILD/grass-6.4.1/dist.x86_64-redhat-linux-
gnu/include/grass/iostream/mm.h:116:15: error: from previous declaration
'void operator delete (void*) throw ()'
make[3]: *** [OBJ.x86_64-redhat-linux-gnu/mm.o] Error 1
}}}

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1533&gt;
GRASS GIS <http://grass.osgeo.org>

#1533: mm.cc fails to build with GCC 4.7
----------------------------------------------+-----------------------------
Reporter: volter | Owner: grass-dev@…
     Type: defect | Status: new
Priority: major | Milestone: 6.4.2
Component: Compiling | Version: 6.4.1
Keywords: libiostream, r.terraflow, gcc4.7 | Platform: Unspecified
      Cpu: Unspecified |
----------------------------------------------+-----------------------------
Changes (by hamish):

  * keywords: => libiostream, r.terraflow, gcc4.7

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/1533#comment:1&gt;
GRASS GIS <http://grass.osgeo.org>

#1533: mm.cc fails to build with GCC 4.7
----------------------------------------------+-----------------------------
Reporter: volter | Owner: grass-dev@…
     Type: defect | Status: new
Priority: major | Milestone: 6.4.2
Component: Compiling | Version: 6.4.1
Keywords: libiostream, r.terraflow, gcc4.7 | Platform: Unspecified
      Cpu: Unspecified |
----------------------------------------------+-----------------------------

Comment(by glynn):

The log doesn't include the actual compilation command. Assuming that this
is the issue originally reported in #1532, the command is:
{{{
c++ -I/builddir/build/BUILD/grass-6.4.1/dist.x86_64-redhat-linux-
gnu/include -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
-fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic
-D_FILE_OFFSET_BITS=64 -DPACKAGE=\""grasslibs"\"
-I/builddir/build/BUILD/grass-6.4.1/dist.x86_64-redhat-linux-gnu/include
-o OBJ.x86_64-redhat-linux-gnu/mm.o -c mm.cc
}}}
I suspect that it's the -fexceptions which is causing the error.
lib/iostream and r.terraflow neither throw nor catch exceptions, so there
isn't actually any reason to use -fexceptions (either way, any exception
will just terminate the program).
OTOH, the exception specifications are part of the signature of the new
and delete operators, so they should be present.
Try r50130 from trunk; if there are no issues, it should be back-ported.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1533#comment:2&gt;
GRASS GIS <http://grass.osgeo.org>

#1533: mm.cc fails to build with GCC 4.7
--------------------------+-------------------------------------------------
  Reporter: volter | Owner: grass-dev@…
      Type: defect | Status: closed
  Priority: major | Milestone: 6.4.2
Component: Compiling | Version: 6.4.1
Resolution: fixed | Keywords: libiostream, r.terraflow, gcc4.7
  Platform: Unspecified | Cpu: Unspecified
--------------------------+-------------------------------------------------
Changes (by martinl):

  * status: new => closed
  * resolution: => fixed

Comment:

Seems to be already backported. Closing this ticket.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1533#comment:3&gt;
GRASS GIS <http://grass.osgeo.org>