Repository navigation
goto-cc: compile files named *.cxx as C++ - #9613
Draft
tautschnig wants to merge 2 commits into
Draft
tautschnig wants to merge 2 commits into
tautschnig wants to merge 2 commits into
Conversation
GCC (manual, "Options Controlling the Kind of Output"), Clang and Visual Studio compile a file named *.cxx as C++ source code. goto-cc's gcc mode did not preprocess such a file, and compilet did not consider it a source file, so `goto-gcc -c x.cxx -o x.o` silently produced a native object file without a goto-cc section, and `goto-cc x.cxx` no goto program. The C++ front end already registers the cxx extension. Add .cxx to the files that gcc mode preprocesses and to the source files that compilet compiles; it was the only C++ source suffix of GCC's list missing (.cc, .cp, .cxx, .cpp, .CPP, .c++, .C, and .ii for preprocessed C++). C++ header files (.hh, .H, .hp, .hxx, .hpp, .HPP, .h++, .tcc) remain ignored, as GCC turns them into precompiled headers, as do GCC 15's C++20 module unit suffixes (.cppm, .ixx, .ccm, .cxxm, .c++m), as the C++ front end does not support modules. Co-authored-by: Kiro <kiro-agent@users.noreply.github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #9613 +/- ##
===========================================
+ Coverage 81.28% 81.34% +0.05%
===========================================
Files 1725 1727 +2
Lines 191618 191748 +130
Branches 73 73
===========================================
+ Hits 155763 155982 +219
+ Misses 35855 35766 -89 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
kroening
approved these changes
Dec 3, 2026
Without -o, `gcc -c` writes <base name>.o for each source file. In hybrid mode, goto-gcc moves the goto binaries that it wrote aside, runs the native compiler and then adds them to the native object files. It predicted the names of the goto binaries from those input files that need preprocessing (.c and C++ source suffixes) instead of those it compiled, so: - `goto-gcc -c x.i` (or x.ii) and `goto-gcc -c -x c x.src` compiled the file, but the native object file then replaced the goto binary: x.o had no goto-cc section; - `goto-gcc -c p/x.c q/x.c` failed with "Rename failed" when moving x.o aside for the second time, while gcc writes x.o twice and keeps the second one. compilet now records the object files it writes in mode COMPILE_ONLY (and ASSEMBLE_ONLY), and gcc mode uses that list, without duplicates. The new tests compile without -o and thus write x.o next to their sources, so the clean target of regression/goto-gcc now removes all object files. Co-authored-by: Kiro <kiro-agent@users.noreply.github.com>
tautschnig
force-pushed
the
kiro/goto-cc-cxx-suffixes
branch
from
December 4, 2026 09:40
c7ea020 to
e6b3a08
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
GCC (manual, "Options Controlling the Kind of Output"), Clang and Visual
Studio compile a file named *.cxx as C++ source code. goto-cc's gcc mode
did not preprocess such a file, and compilet did not consider it a
source file, so
goto-gcc -c x.cxx -o x.osilently produced a nativeobject file without a goto-cc section, and
goto-cc x.cxxno gotoprogram. The C++ front end already registers the cxx extension.
Add .cxx to the files that gcc mode preprocesses and to the source files
that compilet compiles; it was the only C++ source suffix of GCC's list
missing (.cc, .cp, .cxx, .cpp, .CPP, .c++, .C, and .ii for preprocessed
C++). C++ header files (.hh, .H, .hp, .hxx, .hpp, .HPP, .h++, .tcc)
remain ignored, as GCC turns them into precompiled headers, as do
GCC 15's C++20 module unit suffixes (.cppm, .ixx, .ccm, .cxxm, .c++m),
as the C++ front end does not support modules.
Co-authored-by: Kiro kiro-agent@users.noreply.github.com