opensuse clang-3.8 hash_map/unordered_map

Librairie C++ de calcul formel/ C++ symbolic computation library

Modérateur : xcasadmin

frederic han
Messages : 1137
Inscription : dim. mai 20, 2007 7:09 am
Localisation : Paris
Contact :

opensuse clang-3.8 hash_map/unordered_map

Message par frederic han » dim. févr. 11, 2018 10:01 am

Hello bernard,
there is a report of bad detection of hash_map with CC=clang on OpenSuSE Leap 42.3 leading to a compile failure.
cf: https://trac.sagemath.org/ticket/24696

The problem is that this configuration doesn't have hash_map but has unordered_map while the configure think there is hash_map:

Code : Tout sélectionner

checking for clock_gettime in -lrt... yes
checking unordered_map usability... no
checking unordered_map presence... no
checking for unordered_map... no
checking ext/hash_map usability... yes
checking ext/hash_map presence... yes
checking for ext/hash_map... yes
checking tr1/unordered_map usability... yes
checking tr1/unordered_map presence... yes
checking for tr1/unordered_map... yes
checking hash_map usability... yes
checking hash_map presence... yes
checking for hash_map... yes
checking pwd.h usability... yes
cf:
https://trac.sagemath.org/ticket/24696#comment:3

parisse
Messages : 5731
Inscription : mar. déc. 20, 2005 4:02 pm
Contact :

Re: opensuse clang-3.8 hash_map/unordered_map

Message par parisse » dim. févr. 11, 2018 10:40 am

There is already code to detect hash_map in configure.in and index.h. In index.h

Code : Tout sélectionner

#if defined C11_UNORDERED_MAP && (defined __clang__ || !defined __APPLE__)
#undef HASH_MAP
#undef EXT_HASH_MAP
#undef UNORDERED_MAP
#define HASH_MAP_NAMESPACE std
#define hash_map unordered_map
#include <unordered_map>
#endif
How should I change it without breaking other ports (macos/ios and emscripten)?

frederic han
Messages : 1137
Inscription : dim. mai 20, 2007 7:09 am
Localisation : Paris
Contact :

Re: opensuse clang-3.8 hash_map/unordered_map

Message par frederic han » dim. févr. 11, 2018 8:48 pm

it seems the guilty is just after:
removing the !defined(__clang__) seems to fix the pb. Does it breaks things for you?

Code : Tout sélectionner

+diff --git a/giac-1.4.9.45-orig/src/src/index.h b/giac-1.4.9.45/src/src/index.h
+index e74be63..8ed12f9 100755
+--- a/src/index.h
++++ b/src/index.h
+@@ -42,7 +42,7 @@
+ #include <unordered_map>
+ #endif
+ 
+-#if defined UNORDERED_MAP  && !defined(__clang__) && !defined(VISUALC) // && !defined(__APPLE__)
++#if defined UNORDERED_MAP  && !defined(VISUALC) // && !defined(__APPLE__)
+ #include <tr1/unordered_map>
+ #define HASH_MAP_NAMESPACE std::tr1
+ #define hash_map unordered_map

parisse
Messages : 5731
Inscription : mar. déc. 20, 2005 4:02 pm
Contact :

Re: opensuse clang-3.8 hash_map/unordered_map

Message par parisse » lun. févr. 12, 2018 9:54 am

Seems to work, I have committed to geogebra, if it works also there, it should be ok.

Répondre