cppfront icon indicating copy to clipboard operation
cppfront copied to clipboard

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

Open MatthieuHernandez opened this issue 1 year ago • 0 comments

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 https://github.com/hsutter/cppfront/pull/1319 fixes exactly this bug. Do you see a cleaner way to fix this bug?

MatthieuHernandez avatar Oct 17 '24 20:10 MatthieuHernandez