Skip to content

[BUG] Missing #endif in pure cpp1 header file when generated using -import-std #1320

Open
@MatthieuHernandez

Description

@MatthieuHernandez

I've noticed that if I execute cppfront.exe with the -import-std option on a .h file that doesn't contain any cpp2 code, then an #endif will be missing at the end of the file.

This file:
color.h2

enum Color: uint8_t {
    None = 0,
    Black = 1,
    White = 2,
};

With the command below:

cppfront -cwd ./generate ../src/color.h2 -import-std

Gerenates the following cpp1 code with a missing #endif:

#ifndef COLOR_H_CPP2
#define COLOR_H_CPP2

#define CPP2_IMPORT_STD          Yes

#include "cpp2util.h"

enum Color: uint8_t {
    None = 0,
    Black = 1,
    White = 2,
};

@JohelEGP I think the PR #1319 fixes exactly this bug.
Do you see a cleaner way to fix this bug?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions