Skip to content

Use non-reserved name for superlu_xdefs.h.base's include guard - #19

Merged
xiaoyeli merged 1 commit into
masterfrom
claude/fix-reserved-include-guards-superlu-pr189
Nov 14, 2026
Merged

xiaoyeli merged 1 commit into
masterfrom
claude/fix-reserved-include-guards-superlu-pr189

Conversation

@xiaoyeli

Copy link
Copy Markdown
Owner

Background

xiaoyeli/superlu#189 ("Use non-reserved names for header include guards") fixed the sibling serial-SuperLU repo's headers, which used __SUPERLU_*-style include guards — identifiers beginning with two underscores are reserved for the implementation in C and C++. It renamed guards like __SUPERLU_dSP_DEFS to SUPERLU_dSP_DEFS_H across slu_Cnames.h, slu_cdefs.h, slu_dcomplex.h, slu_ddefs.h, slu_scomplex.h, slu_sdefs.h, slu_util.h, slu_zdefs.h, superlu_enum_consts.h, and supermatrix.h.

This repo's equivalent

superlu_dist_base doesn't track most of those files at all (supermatrix.h, superlu_enum_consts.h, dcomplex.h, etc. are precision-independent and copied as-is into superlu_dist, with no .base template here). The one file in this repo with the same reserved-guard pattern is SRC/superlu_xdefs.h.base, which generates superlu_sdefs.h/superlu_ddefs.h/superlu_zdefs.h (per the Makefile) and used:

#ifndef __SUPERLU_@(PRE)DEFS /* allow multiple inclusions */
#define __SUPERLU_@(PRE)DEFS
...
#endif /* __SUPERLU_@(pre)DEFS */

This PR renames it to SUPERLU_@(PRE)DEFS_H, matching the upstream fix's convention (drop the leading double underscore, append _H). It also fixes the closing #endif comment, which used a lowercase @(pre) that didn't even match the uppercase @(PRE) in the #ifndef/#define — a pre-existing cosmetic mismatch, harmless since it's just a comment, but worth aligning while touching this line.

Not touched

SRC/OLD_TriSolve/superlu_xdefs.h.base and SRC/bak/superlu_xdefs.h.base.bak have the identical pattern, but neither is referenced by the Makefile, so neither feeds the active template generation — left alone as dead/legacy copies.


Generated by Claude Code

Identifiers that begin with two underscores are reserved for the
implementation in C and C++ (xiaoyeli/superlu#189, "Use non-reserved
names for header include guards", which fixed the same __SUPERLU_*
pattern in the sibling serial-SuperLU repo's slu_*defs.h headers).

superlu_xdefs.h.base generates superlu_sdefs.h/superlu_ddefs.h/
superlu_zdefs.h (see Makefile) and used #ifndef/#define
__SUPERLU_@(PRE)DEFS as its include guard. Rename it to
SUPERLU_@(PRE)DEFS_H, and fix the closing #endif comment to match (it
previously used a lowercase @(pre) that didn't even match the
uppercase @(PRE) used by the #ifndef/#define, a pre-existing cosmetic
mismatch).

The identical guard pattern in SRC/OLD_TriSolve/superlu_xdefs.h.base
and SRC/bak/superlu_xdefs.h.base.bak is left alone: neither is
referenced by the Makefile, so neither feeds the active template
generation.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011vhWoBbcvH5n4PgHLzLYev
@xiaoyeli
xiaoyeli merged commit 7e343ff into master Nov 14, 2026
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

Successfully merging this pull request may close these issues.

2 participants