diff options
author | DJ Delorie <dj@delorie.com> | 2009-06-03 21:02:16 +0000 |
---|---|---|
committer | DJ Delorie <dj@delorie.com> | 2009-06-03 21:02:16 +0000 |
commit | ad80246e559bf16a5d1d30ac8fb3b1978f033f9c (patch) | |
tree | 42b000995e6f48e42eba663fdec891d94caca612 /include/ansidecl.h | |
parent | 27a0a2c5bd6bdef0bf5bb53d98d0ea6d2f0696c7 (diff) | |
download | gdb-ad80246e559bf16a5d1d30ac8fb3b1978f033f9c.tar.gz |
merge from gcc
Diffstat (limited to 'include/ansidecl.h')
-rw-r--r-- | include/ansidecl.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/include/ansidecl.h b/include/ansidecl.h index c83b8c039d9..f9864cd3864 100644 --- a/include/ansidecl.h +++ b/include/ansidecl.h @@ -395,6 +395,18 @@ So instead we use the macro below and test it against specific values. */ #define __extension__ #endif +/* This is used to declare a const variable which should be visible + outside of the current compilation unit. Use it as + EXPORTED_CONST int i = 1; + This is because the semantics of const are different in C and C++. + "extern const" is permitted in C but it looks strange, and gcc + warns about it when -Wc++-compat is not used. */ +#ifdef __cplusplus +#define EXPORTED_CONST extern const +#else +#define EXPORTED_CONST const +#endif + #ifdef __cplusplus } #endif |