0003-fix-C++14.patch 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. dumapp: fix for C++14
  2. With C++14, the way exceptions are specified has changed (somehow, don't
  3. ask me), thus causing build failures:
  4. dumapp.cpp: In function ‘void* operator new(std::size_t)’:
  5. dumapp.cpp:192:19: error: declaration of ‘void* operator new(std::size_t) throw (std::bad_alloc)’ has a different exception specifier
  6. void * DUMA_CDECL operator new( DUMA_SIZE_T size )
  7. ^~~~~~~~
  8. In file included from dumapp.cpp:39:0:
  9. dumapp.h:91:23: note: from previous declaration ‘void* operator new(std::size_t)’
  10. void * DUMA_CDECL operator new(DUMA_SIZE_T) throw(std::bad_alloc);
  11. ^~~~~~~~
  12. This is most evident with gcc-6.x, since the default C++ standard has
  13. changed from C++11 to C++14, thus exposing these new failures.
  14. Fix that by guarding the exception handling, a bit like was done
  15. with GRASS GIS (thanks DuckDuckGo):
  16. https://trac.osgeo.org/grass/changeset?old_path=%2F&old=68817&new_path=%2F&new=68818&sfp_email=&sfph_mail=
  17. Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
  18. ---
  19. Note: The last commit in DUMA's CVS repo was more than 7 years ago.
  20. I doubt it is still active, so the patch was not sent upstream. :-/
  21. diff -durN duma-2.5.15.orig/dumapp.cpp duma-2.5.15/dumapp.cpp
  22. --- duma-2.5.15.orig/dumapp.cpp 2008-08-03 22:46:06.000000000 +0200
  23. +++ duma-2.5.15/dumapp.cpp 2016-07-10 21:55:22.670386099 +0200
  24. @@ -190,7 +190,9 @@
  25. * (11) = (a) ; ASW
  26. */
  27. void * DUMA_CDECL operator new( DUMA_SIZE_T size )
  28. +#ifdef DUMA_EXCEPTION_SPECS
  29. throw(std::bad_alloc)
  30. +#endif
  31. {
  32. return duma_new_operator(size, EFA_NEW_ELEM, true DUMA_PARAMS_UK);
  33. }
  34. @@ -254,7 +256,9 @@
  35. * (21) = (a) ; AAW
  36. */
  37. void * DUMA_CDECL operator new[]( DUMA_SIZE_T size )
  38. +#ifdef DUMA_EXCEPTION_SPECS
  39. throw(std::bad_alloc)
  40. +#endif
  41. {
  42. return duma_new_operator(size, EFA_NEW_ARRAY, true DUMA_PARAMS_UK);
  43. }
  44. diff -durN duma-2.5.15.orig/dumapp.h duma-2.5.15/dumapp.h
  45. --- duma-2.5.15.orig/dumapp.h 2009-04-11 14:41:44.000000000 +0200
  46. +++ duma-2.5.15/dumapp.h 2016-07-10 21:55:22.670386099 +0200
  47. @@ -35,6 +35,10 @@
  48. #include "duma.h"
  49. +#if __cplusplus < 201103L
  50. + #define DUMA_EXCEPTION_SPECS 1
  51. +#endif
  52. +
  53. /* remove previous macro definitions */
  54. #include "noduma.h"