Skip to content

Commit c66a8c6

Browse files
committed
Improve GCC 15 compatibility
1 parent f5b6da3 commit c66a8c6

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

packages/cxx-gen-ast/src/gen_ast_pretty_printer_cc.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ export function gen_ast_pretty_printer_cc({
256256
nodes.forEach(({ name, members }) => {
257257
emit();
258258
emit(
259-
`void ASTPrettyPrinter::${className}Visitor::operator()(${name}* ast) {`,
259+
`void ASTPrettyPrinter::${className}Visitor::operator()(${name}* ast) {`
260260
);
261261

262262
members.forEach((m) => {
@@ -303,6 +303,10 @@ if (ast->op == TokenKind::T_NEW_ARRAY) {
303303
emit(`accept.write("{}", Token::spell(ast->op));`);
304304
} else {
305305
emit(`accept.writeToken(ast->${m.name});`);
306+
307+
if (m.name == "captureDefaultLoc") {
308+
emit(`if (ast->captureList) accept.write(",");`);
309+
}
306310
}
307311

308312
// post token
@@ -331,7 +335,7 @@ if (ast->op == TokenKind::T_NEW_ARRAY) {
331335
if (isCommaSeparated(m, name)) {
332336
if (["enumeratorList"].includes(m.name)) {
333337
emit(
334-
`if (it->next) { nospace(); accept.write(","); newline(); }`,
338+
`if (it->next) { nospace(); accept.write(","); newline(); }`
335339
);
336340
} else {
337341
emit(`if (it->next) { nospace(); accept.write(","); }`);

src/parser/cxx/ast_pretty_printer.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2256,6 +2256,7 @@ void ASTPrettyPrinter::ExpressionVisitor::operator()(LambdaExpressionAST* ast) {
22562256
}
22572257
if (ast->captureDefaultLoc) {
22582258
accept.writeToken(ast->captureDefaultLoc);
2259+
if (ast->captureList) accept.write(",");
22592260
}
22602261

22612262
for (auto it = ast->captureList; it; it = it->next) {

src/parser/cxx/gcc_linux_toolchain.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ namespace cxx {
2929
GCCLinuxToolchain::GCCLinuxToolchain(Preprocessor* preprocessor,
3030
std::string arch)
3131
: Toolchain(preprocessor), arch_(std::move(arch)) {
32-
for (int version : {14, 13, 12, 11, 10, 9}) {
32+
for (int version : {15, 14, 13, 12, 11, 10, 9}) {
3333
const auto path = fs::path(
3434
std::format("/usr/lib/gcc/{}-linux-gnu/{}/include", arch_, version));
3535

src/parser/cxx/parser.cc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,15 +181,14 @@ Parser::Parser(TranslationUnit* unit) : unit(unit), binder_(unit) {
181181
globalScope_ = unit->globalScope();
182182
setScope(globalScope_);
183183

184-
// temporary workarounds to the gnu until we have a proper
184+
// temporary workarounds to GNU STL until we have a proper
185185
// support for templates
186186
mark_maybe_template_name(control_->getIdentifier("__remove_reference_t"));
187-
// mark_maybe_template_name(control_->getIdentifier("__integer_pack"));
188-
189187
template_names_.insert(control_->getIdentifier("_S_invoke"));
190188
template_names_.insert(control_->getIdentifier("__type_pack_element"));
191189
template_names_.insert(control_->getIdentifier("__make_integer_seq"));
192190
template_names_.insert(control_->getIdentifier("_S_nothrow_construct"));
191+
template_names_.insert(control_->getIdentifier("_S_nothrow_destroy"));
193192
}
194193

195194
Parser::~Parser() = default;

0 commit comments

Comments
 (0)