summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel Scherer <gabriel.scherer@gmail.com>2015-08-02 16:54:22 +0000
committerGabriel Scherer <gabriel.scherer@gmail.com>2015-08-02 16:54:22 +0000
commit2f2b2f0bd169a7c9d366e9d0de817bb4c28fa745 (patch)
treeb2fa677010ba20ba2e7e8e369425255a4746ab33
parentedb714dc15a8ba9e0ee658e4e34499f497aa957d (diff)
downloadocaml-2f2b2f0bd169a7c9d366e9d0de817bb4c28fa745.tar.gz
GPR#165: refactor and document CAMLunused{,_start,_end}
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16314 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
-rw-r--r--byterun/caml/memory.h25
1 files changed, 12 insertions, 13 deletions
diff --git a/byterun/caml/memory.h b/byterun/caml/memory.h
index bedc6b43a4..804b947ae5 100644
--- a/byterun/caml/memory.h
+++ b/byterun/caml/memory.h
@@ -152,29 +152,28 @@ CAMLextern struct caml__roots_block *caml_local_roots; /* defined in roots.c */
CAMLparam0 (); \
CAMLxparamN (x, (size))
-#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 7))
- #define CAMLunused __attribute__ ((unused))
-#else
- #define CAMLunused
-#endif
-
+/* CAMLunused is preserved for compatibility reasons.
+ Instead of the legacy GCC/Clang-only
+ CAMLunused foo;
+ you should prefer
+ CAMLunused_start foo CAMLunused_end;
+ which supports both GCC/Clang and MSVC.
+*/
#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 7))
#define CAMLunused_start __attribute__ ((unused))
+ #define CAMLunused_end
+ #define CAMLunused __attribute__ ((unused))
#elif _MSC_VER >= 1500
#define CAMLunused_start __pragma( warning (push) ) \
__pragma( warning (disable:4189 ) )
-
-#else
- #define CAMLunused_start
-#endif
-
-#if defined _MSC_VER >= 1500
#define CAMLunused_end __pragma( warning (pop))
+ #define CAMLunused
#else
+ #define CAMLunused_start
#define CAMLunused_end
+ #define CAMLunused
#endif
-
#define CAMLxparam1(x) \
struct caml__roots_block caml__roots_##x; \
CAMLunused_start int caml__dummy_##x = ( \