Skip to content

Adopt a different convention re order of includes#787

Merged
jennybc merged 2 commits into
mainfrom
reorder-header-includes
May 6, 2026
Merged

Adopt a different convention re order of includes#787
jennybc merged 2 commits into
mainfrom
reorder-header-includes

Conversation

@jennybc

@jennybc jennybc commented May 5, 2026

Copy link
Copy Markdown
Member

Fixes #775 and, hopefully, heads off future Alpine issues of this nature.

Exactly why I was ordering includes as I was has been lost in the sands of time. But this seems more conventional:

system → cpp11 → other vendored (libxls, rapidxml) → project

Within the group, alphabetical. Blank lines between.

For a .cpp file, the corresponding .h sits at the top.

Why system before libxls? we want standard headers like <stdint.h> processed in the global namespace, not inside xls. This is #775. (And pretty similar stories in #562, #676, #714.)

Why cpp11 before libxls? libxls transitively pulls in <Rinternals.h> via cran.h, and cpp11 needs to set R_NO_REMAP/STRICT_R_HEADERS before any R header is processed

jennybc added 2 commits May 5, 2026 16:22
Fixes #775 and, hopefully, heads off future Alpine issues of this nature.

Exactly why I was ordering includes as I was has been lost in the sands of time. But this seems more conventional:

system → cpp11 → other vendored (libxls, rapidxml) → project

Within the group, alphabetical. Blank lines between.

For a .cpp file, the corresponding .h sits at the top.

Why system before libxls? we want standard headers like <stdint.h> processed in the global namespace, not inside xls. This is #775.

Why cpp11 before libxls? libxls transitively pulls in <Rinternals.h> via cran.h, and cpp11 needs to set R_NO_REMAP/STRICT_R_HEADERS before any R header is processed
@jennybc jennybc merged commit fe6a883 into main May 6, 2026
11 checks passed
@jeroen

jeroen commented May 12, 2026

Copy link
Copy Markdown
Contributor

I think this broke the wasm build 😢 https://github.com/r-universe/tidyverse/actions/runs/25623880286/job/75215538375?

Also note this pr commits a merge conflict to NEWS.md 🙈

@jennybc

jennybc commented May 12, 2026

Copy link
Copy Markdown
Member Author

Eew, I even used the web interface to resolve the conflict, but obviously did something stupid. I just fixed up NEWS on main.

Are you game to open a proper issue for the WASM thing? Pleasing all the platforms re: header includes feels like whack-a-mole 😬

@jennybc jennybc deleted the reorder-header-includes branch May 12, 2026 22:44
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.

Declaration of int64_t causes failure on Alpine

2 participants