Skip to content

Detect C++ source and header extensions beyond .cpp - #44

Merged
sabbaticas merged 1 commit into
mainfrom
feat/cpp-extension-mappings
Oct 10, 2026
Merged

sabbaticas merged 1 commit into
mainfrom
feat/cpp-extension-mappings

Conversation

@sabbaticas

Copy link
Copy Markdown
Contributor

Closes #43.

Summary

  • .cc, .cxx and .c++ now report as C++.
  • .hpp, .hh, .hxx and .h++ now report as C++ Header, a new language paralleling C Header.
  • .h is unchanged and still reports C Header.

Only .cpp was mapped before, so a codebase using .cc and .hpp showed no C++ at all.

Before and after

File Before After
file.cc, file.cxx, file.c++ Unknown C++
file.hpp, file.hh, file.hxx, file.h++ Unknown C++ Header
file.cpp C++ C++
file.h C Header C Header

Source

All seven are in the GCC documentation's list of C++ suffixes.

Design notes

  • C++ Header is a new language name. Headers are reported separately from sources because that is what panopticas already does for C. Reporting them as plain C++ was considered and rejected as inconsistent with .h.
  • .h is not resolved here. It is shared by C, C++ and Objective-C; that is the subject of Proposal: disambiguate .m (Objective-C, MATLAB) and .h (C, C++, Objective-C) #40.
  • .C and .H are not mapped. GCC treats the capitalised forms as C++, but panopticas lowercases extensions before lookup, so they still report as C and C Header.
  • The changes note has a table of every C++ suffix considered and left unmapped, with the reason for each.

Things to note

  • Additive only: no existing mapping changes, so kospex is unaffected until a re-sync.
  • Vocabulary is now 89 filetypes and 34 languages; tags are unchanged at 123. The docs site counts are updated to match.
  • The version stays at 0.0.21, which is unreleased.

Testing

  • pytest: 757 passed. The new tests were written first and failed before the change; one asserts .h still reports C Header.
  • A fixture for each of the seven extensions is added in src/tests/; panopticas assess shows each with the expected filetype.

🤖 Generated with Claude Code

.cc, .cxx and .c++ now report as C++, and .hpp, .hh, .hxx and .h++ as
C++ Header, a new language paralleling C Header. Only .cpp was mapped
before, so a codebase using .cc and .hpp showed no C++ at all.

All seven are in GCC's documented list of C++ suffixes. .h is unchanged:
it is shared by C, C++ and Objective-C and cannot be resolved from the
path.

The changes note lists every C++ suffix considered and left unmapped,
with the reason for each. The docs site counts are updated to 89
filetypes and 34 languages.

Closes #43

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sabbaticas
sabbaticas merged commit 6f14487 into main Oct 10, 2026
5 checks passed
@sabbaticas
sabbaticas deleted the feat/cpp-extension-mappings branch October 10, 2026 23:02
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.

Detect C++ source and header extensions beyond .cpp

1 participant