diff options
author | px4dev <px4@purgatory.org> | 2012-08-25 16:12:48 -0700 |
---|---|---|
committer | px4dev <px4@purgatory.org> | 2012-08-25 16:12:48 -0700 |
commit | 30e0354fd83b1f487ca6a464af78ac5b4ab3cf13 (patch) | |
tree | e960db536c4c17dbe19ff9cc1e81029763db3498 | |
parent | f2ab85756c173bd8c231f72c09e50d2a2d3aab42 (diff) | |
download | px4-firmware-30e0354fd83b1f487ca6a464af78ac5b4ab3cf13.tar.gz px4-firmware-30e0354fd83b1f487ca6a464af78ac5b4ab3cf13.tar.bz2 px4-firmware-30e0354fd83b1f487ca6a464af78ac5b4ab3cf13.zip |
Add some C++ friendliness. Not enough, but some.
-rw-r--r-- | apps/systemlib/param/param.h | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/apps/systemlib/param/param.h b/apps/systemlib/param/param.h index 643d0ef7b..16ab7f5cd 100644 --- a/apps/systemlib/param/param.h +++ b/apps/systemlib/param/param.h @@ -47,10 +47,13 @@ #include <stdint.h> #include <stdbool.h> +#include <sys/types.h> /** Maximum size of the parameter backing file */ #define PARAM_FILE_MAXSIZE 4096 +__BEGIN_DECLS + /** * Parameter types. */ @@ -192,6 +195,10 @@ __EXPORT void param_foreach(void (*func)(void *arg, param_t param), void *arg, * Note that these structures are not known by name; they are * collected into a section that is iterated by the parameter * code. + * + * Note that these macros cannot be used in C++ code due to + * their use of designated initializers. They should probably + * be refactored to avoid the use of a union for param_value_u. */ /** define an int32 parameter */ @@ -199,9 +206,9 @@ __EXPORT void param_foreach(void (*func)(void *arg, param_t param), void *arg, static const \ __attribute__((used, section("__param"))) \ struct param_info_s __param__##_name = { \ - .name = #_name, \ - .type = PARAM_TYPE_INT32, \ - .val.i = _default \ + #_name, \ + PARAM_TYPE_INT32, \ + .val.i = _default \ } /** define a float parameter */ @@ -209,9 +216,9 @@ __EXPORT void param_foreach(void (*func)(void *arg, param_t param), void *arg, static const \ __attribute__((used, section("__param"))) \ struct param_info_s __param__##_name = { \ - .name = #_name, \ - .type = PARAM_TYPE_FLOAT, \ - .val.f = _default \ + #_name, \ + PARAM_TYPE_FLOAT, \ + .val.f = _default \ } /** define a parameter that points to a structure */ @@ -219,9 +226,9 @@ __EXPORT void param_foreach(void (*func)(void *arg, param_t param), void *arg, static const \ __attribute__((used, section("__param"))) \ struct param_info_s __param__##_name = { \ - .name = #_name, \ - .type = PARAM_TYPE_STRUCT + sizeof(_default), \ - .val.p = &_default; \ + #_name, \ + PARAM_TYPE_STRUCT + sizeof(_default), \ + .val.p = &_default; \ } /** @@ -245,4 +252,6 @@ struct param_info_s { union param_value_u val; }; +__END_DECLS + #endif |