Skip to content

Commit

Permalink
Add some checks to defs.h to ensure that the library isn't built as o…
Browse files Browse the repository at this point in the history
…ld C, C++, or with disabled features
  • Loading branch information
aaaaaa123456789 committed Jan 14, 2022
1 parent a2ec4a0 commit 056abb9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

#define PLUM_DEFS

#if defined(PLUM_NO_STDINT) || defined(PLUM_NO_ANON_MEMBERS) || defined(PLUM_NO_VLA)
#error libplum feature-test macros must not be defined when compiling the library.
#elif defined(__cplusplus)
#error libplum cannot be compiled with a C++ compiler.
#elif __STDC_VERSION__ < 201710L
#error libplum requires C17 or later.
#endif

#ifdef noreturn
#undef noreturn
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/proto.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
#include <stdint.h>
#include <setjmp.h>

#include "../header/libplum.h"
#include "defs.h"
#include "../header/libplum.h"
#include "struct.h"

#include "multibyte.h"
Expand Down

0 comments on commit 056abb9

Please sign in to comment.