Re: [Mesa-dev] [PATCH v3] math: Import isinf and others to global namespace

2016-04-18 Thread Pierre Moreau
Thanks a lot Jose! If it hasn’t been done yet, could you please revert the
commit you pushed that only affected Nouveau, since it’s now unnecessary, and
furthermore, didn’t had the glibc check.

Thanks!
Pierre

On 11:21 AM - Apr 18 2016, Jose Fonseca wrote:
> Thanks. I've tweak the version check logic and pushed.
> 
> Jose
> 
> On 14/04/16 19:43, Pierre Moreau wrote:
> >Starting from C++11, several math functions, like isinf, moved into the std
> >namespace. Since cmath undefines those functions before redefining them 
> >inside
> >the namespace, and glibc 2.23 defines the C variants as macros, the C 
> >variants
> >in global namespace are not accessible any longer.
> >
> >v2: Move the fix outside of Nouveau, as suggested by Jose Fonseca, since 
> >anyone
> > might need it when GCC switches to C++14 by default with GCC 6.0.
> >
> >v3:
> >*   Put the code directly inside c99_math.h rather than creating a new header
> > file, as asked by Jose Fonseca;
> >*   Guard the code behind glibc version checks, as only glibc > =2.23 defines
> > isinf & co. as functions, as suggested by Jose Fonseca.
> >
> >Signed-off-by: Pierre Moreau 
> >---
> >  include/c99_math.h | 23 +++
> >  1 file changed, 23 insertions(+)
> >
> >diff --git a/include/c99_math.h b/include/c99_math.h
> >index 250e08d..192ff13 100644
> >--- a/include/c99_math.h
> >+++ b/include/c99_math.h
> >@@ -185,4 +185,27 @@ fpclassify(double x)
> >  #endif
> >
> >
> >+/* Since C++11, the following functions are part of the std namespace. 
> >Their C
> >+ * counteparts should still exist in the global namespace, however cmath
> >+ * undefines those functions, which in glibc 2.23, are defined as macros 
> >rather
> >+ * than functions as in glibc 2.22.
> >+ */
> >+#if __cplusplus >= 201103L && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 23
> >+#include 
> >+
> >+using std::fpclassify;
> >+using std::isfinite;
> >+using std::isinf;
> >+using std::isnan;
> >+using std::isnormal;
> >+using std::signbit;
> >+using std::isgreater;
> >+using std::isgreaterequal;
> >+using std::isless;
> >+using std::islessequal;
> >+using std::islessgreater;
> >+using std::isunordered;
> >+#endif
> >+
> >+
> >  #endif /* #define _C99_MATH_H_ */
> >
> 


signature.asc
Description: PGP signature
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH v3] math: Import isinf and others to global namespace

2016-04-18 Thread Jose Fonseca

Thanks. I've tweak the version check logic and pushed.

Jose

On 14/04/16 19:43, Pierre Moreau wrote:

Starting from C++11, several math functions, like isinf, moved into the std
namespace. Since cmath undefines those functions before redefining them inside
the namespace, and glibc 2.23 defines the C variants as macros, the C variants
in global namespace are not accessible any longer.

v2: Move the fix outside of Nouveau, as suggested by Jose Fonseca, since anyone
 might need it when GCC switches to C++14 by default with GCC 6.0.

v3:
*   Put the code directly inside c99_math.h rather than creating a new header
 file, as asked by Jose Fonseca;
*   Guard the code behind glibc version checks, as only glibc > =2.23 defines
 isinf & co. as functions, as suggested by Jose Fonseca.

Signed-off-by: Pierre Moreau 
---
  include/c99_math.h | 23 +++
  1 file changed, 23 insertions(+)

diff --git a/include/c99_math.h b/include/c99_math.h
index 250e08d..192ff13 100644
--- a/include/c99_math.h
+++ b/include/c99_math.h
@@ -185,4 +185,27 @@ fpclassify(double x)
  #endif


+/* Since C++11, the following functions are part of the std namespace. Their C
+ * counteparts should still exist in the global namespace, however cmath
+ * undefines those functions, which in glibc 2.23, are defined as macros rather
+ * than functions as in glibc 2.22.
+ */
+#if __cplusplus >= 201103L && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 23
+#include 
+
+using std::fpclassify;
+using std::isfinite;
+using std::isinf;
+using std::isnan;
+using std::isnormal;
+using std::signbit;
+using std::isgreater;
+using std::isgreaterequal;
+using std::isless;
+using std::islessequal;
+using std::islessgreater;
+using std::isunordered;
+#endif
+
+
  #endif /* #define _C99_MATH_H_ */



___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH v3] math: Import isinf and others to global namespace

2016-04-14 Thread Pierre Moreau
Starting from C++11, several math functions, like isinf, moved into the std
namespace. Since cmath undefines those functions before redefining them inside
the namespace, and glibc 2.23 defines the C variants as macros, the C variants
in global namespace are not accessible any longer.

v2: Move the fix outside of Nouveau, as suggested by Jose Fonseca, since anyone
might need it when GCC switches to C++14 by default with GCC 6.0.

v3:
*   Put the code directly inside c99_math.h rather than creating a new header
file, as asked by Jose Fonseca;
*   Guard the code behind glibc version checks, as only glibc > =2.23 defines
isinf & co. as functions, as suggested by Jose Fonseca.

Signed-off-by: Pierre Moreau 
---
 include/c99_math.h | 23 +++
 1 file changed, 23 insertions(+)

diff --git a/include/c99_math.h b/include/c99_math.h
index 250e08d..192ff13 100644
--- a/include/c99_math.h
+++ b/include/c99_math.h
@@ -185,4 +185,27 @@ fpclassify(double x)
 #endif
 
 
+/* Since C++11, the following functions are part of the std namespace. Their C
+ * counteparts should still exist in the global namespace, however cmath
+ * undefines those functions, which in glibc 2.23, are defined as macros rather
+ * than functions as in glibc 2.22.
+ */
+#if __cplusplus >= 201103L && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 23
+#include 
+
+using std::fpclassify;
+using std::isfinite;
+using std::isinf;
+using std::isnan;
+using std::isnormal;
+using std::signbit;
+using std::isgreater;
+using std::isgreaterequal;
+using std::isless;
+using std::islessequal;
+using std::islessgreater;
+using std::isunordered;
+#endif
+
+
 #endif /* #define _C99_MATH_H_ */
-- 
2.8.0

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev