MochiLibraries / Biohazrd

A framework for automatically generating binding wrappers for C/C++ libraries
MIT License
60 stars 8 forks source link

Test including the same file more than once without header guards #66

Open PathogenDavid opened 3 years ago

PathogenDavid commented 3 years ago

We currently don't expect the same file to appear in the cursor tree more than once with a different CXFile handle:

https://github.com/InfectedLibraries/Biohazrd/blob/23589dbdba1590a863097eba071bb0f5c7919df0/Biohazrd/TranslationUnitParser.cs#L123-L124

We need to test if this is possible to trigger if a file is included more than once without header guards:

FileA.h

#pragma once

#define MAKE_FUNCTION(rettype) rettype FunctionB1();
#include "FileB.h"

#undef MAKE_FUNCTION
#define MAKE_FUNCTION(rettype) rettype FunctionB2();
#include "FileB.h"

FileB.h

MAKE_FUNCTION(int);
PathogenDavid commented 3 years ago

Now that we have automated testing, this should just be implemented as a unit test.