-
Notifications
You must be signed in to change notification settings - Fork 240
Closed
Labels
Description
I'd like to add support for CompCert to Hedley, but AFAICT there is no way to tell from the preprocessor which version of CompCert is in use, so there is no way to tell when certain features can be enabled.
For example, it looks like noinline was added with version 3.2, so if I'd like to be able to do something like
#if defined(__COMPCERT__) && (__COMPCERT__ >= 30200)
# define HEDLEY_NO_INLINE __attribute((noinline))
#else
# define HEDLEY_NO_INLINE
#endifIt looks like this would basically just require something like
diff --git a/driver/Frontend.ml b/driver/Frontend.ml
index 88b47854..30d78592 100644
--- a/driver/Frontend.ml
+++ b/driver/Frontend.ml
@@ -19,7 +19,7 @@ open Driveraux
let predefined_macros =
[
- "-D__COMPCERT__";
+ "-D__COMPCERT__=30500";
"-U__STDC_IEC_559_COMPLEX__";
"-D__STDC_NO_ATOMICS__";
"-D__STDC_NO_COMPLEX__";But obviously the version number shouldn't be hard-coded, and I'm not sure where to get it.