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

Macros with general names in Flame.h break compilation #48

Open
stefanozampini opened this issue May 5, 2021 · 0 comments
Open

Macros with general names in Flame.h break compilation #48

stefanozampini opened this issue May 5, 2021 · 0 comments

Comments

@stefanozampini
Copy link

With a configuration like
./configure --enable-arg-max-hack --enable-lapack2flame
we currently get a lot of non-namespaced defines when including Flame.h in a source code

Specifically, the min define breaks compilation with GCC 10.2

 /sw/csi/gcc/10.2.0/include/c++/10.2.0/bits/istream.tcc: In member function ‘std::streamsize std::basic_istream<_CharT, _Traits>::readsome(std::basic_istream<_CharT, _Traits>::char_type*, std::streamsize)’:
/home/zampins/amd/src/local/include/FLAME.h:830:21: error: expected unqualified-id before ‘(’ token
  830 | #define min( x, y ) ( (x) < (y) ? (x) : (y) )

Here is a list of the most interesting ones. Is it possible to namespace them?

#undef  NULL
#define NULL 0

#undef  TRUE
#undef  FALSE
#define TRUE  1
#define FALSE 0

#undef min
#define min( x, y ) ( (x) < (y) ? (x) : (y) )

#undef max
#define max( x, y ) ( (x) > (y) ? (x) : (y) )

#undef signof
#define signof( a, b ) ( (b) >= 0 ? (a) : -(a) )

#undef exchange
#define exchange( a, b, temp ) { temp = a; a = b; b = temp; }
#define TRUE_ (1)
#define FALSE_ (0)

#ifndef f2c_abs
  #define f2c_abs(x) ((x) >= 0 ? (x) : -(x))
#endif
#ifndef f2c_dabs
  #define f2c_dabs(x) (doublereal)f2c_abs(x)
#endif
#ifndef min
  #define min(a,b) ((a) <= (b) ? (a) : (b))
#endif
#ifndef max
  #define max(a,b) ((a) >= (b) ? (a) : (b))
#endif
#ifndef dmin
  #define dmin(a,b) (doublereal)min(a,b)
#endif
#ifndef dmax
  #define dmax(a,b) (doublereal)max(a,b)
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant