Skip to content

Commit

Permalink
auxiliarySoftware/SuiteSparse: update naming of EMPTY macro
Browse files Browse the repository at this point in the history
The macro `EMPTY` is defined in multiple solvers in the
auxiliarySoftware/SuiteSparse common package. This can cause issues with
other software, as in trilinos#11630 for example which builds with cuda/11.4 and
includes cub files that define a static variable of the same name

This PR renames the EMPTY macro defined in the following
places:
* AMD/Include/trilinos_amd_internal.h
* BTF/Include/trilinos_btf_internal.h
* CAMD/Include/trilinos_camd_internal.h
* CHOLMOD/Include/amesos_cholmod_internal.h
* KLU/Include/trilinos_klu_internal.h
* CCOLAMD/Source/trilinos_ccolamd.c
* CCOLAMD/Source/trilinos_ccolamd_l.c
* COLAMD/Source/trilinos_colamd.c
* COLAMD/Source/trilinos_colamd_l.c

and updates the usage of that macro in the corresponding source code

Note: The PARAKLETE solver includes amesos_cholmod_internal.h from which
it received its definition of EMPTY; in the PARAKLETE source code I
renamed the use of EMPTY to follow the cholmod naming convention, TRILINOS_CHOLMOD_EMPTY
  • Loading branch information
ndellingwood committed Mar 7, 2023
1 parent b30c097 commit ffb6b01
Show file tree
Hide file tree
Showing 99 changed files with 1,330 additions and 1,327 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@
#undef MIN
#endif

#ifdef EMPTY
#undef EMPTY
#ifdef TRILINOS_AMD_EMPTY
#undef TRILINOS_AMD_EMPTY
#endif

#ifdef GLOBAL
Expand All @@ -114,12 +114,12 @@
#endif

/* FLIP is a "negation about -1", and is used to mark an integer i that is
* normally non-negative. FLIP (EMPTY) is EMPTY. FLIP of a number > EMPTY
* normally non-negative. FLIP (TRILINOS_AMD_EMPTY) is TRILINOS_AMD_EMPTY. FLIP of a number > TRILINOS_AMD_EMPTY
* is negative, and FLIP of a number < EMTPY is positive. FLIP (FLIP (i)) = i
* for all integers i. UNFLIP (i) is >= EMPTY. */
#define EMPTY (-1)
* for all integers i. UNFLIP (i) is >= TRILINOS_AMD_EMPTY. */
#define TRILINOS_AMD_EMPTY (-1)
#define FLIP(i) (-(i)-2)
#define UNFLIP(i) ((i < EMPTY) ? FLIP (i) : (i))
#define UNFLIP(i) ((i < TRILINOS_AMD_EMPTY) ? FLIP (i) : (i))

/* for integer MAX/MIN, or for doubles when we don't care how NaN's behave: */
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
Expand All @@ -141,7 +141,7 @@
#define FALSE (0)
#define PRIVATE static
#define GLOBAL
#define EMPTY (-1)
#define TRILINOS_AMD_EMPTY (-1)

/* Note that Linux's gcc 2.96 defines NULL as ((void *) 0), but other */
/* compilers (even gcc 2.95.2 on Solaris) define NULL as 0 or (0). We */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ GLOBAL void TRILINOS_AMD_1
ASSERT (iwlen >= pfree + n) ;

#ifndef NDEBUG
for (p = 0 ; p < iwlen ; p++) Iw [p] = EMPTY ;
for (p = 0 ; p < iwlen ; p++) Iw [p] = TRILINOS_AMD_EMPTY ;
#endif

for (k = 0 ; k < n ; k++)
Expand Down
Loading

0 comments on commit ffb6b01

Please sign in to comment.