ros / dynamic_reconfigure

BSD 3-Clause "New" or "Revised" License
48 stars 111 forks source link

Enum descriptions with single quotes #64

Closed DLu closed 7 years ago

DLu commented 7 years ago

If you write an enum description with a single quote and use it in C++, you will get some weird errors.

example package

dyn_param_error.zip

this works

combo_enum = gen.enum([
        gen.const("A", int_t, 0, "I can do it"),
        gen.const("B", int_t, 0, "I cant do it"),
       ],
  "x")

This doesn't

        gen.const("B", int_t, 0, "I can't do it"),

Errors

In file included from /home/dlu/bnr_software/src/bnr_autonomy/bnr_navigation/dyn_param_error/src/x.cpp:1:0:
/home/dlu/bnr_software/devel/include/dyn_param_error/DynParamConfig.h:387:475: warning: character constant too long for its type [enabled by default]
       Default.abstract_parameters.push_back(DynParamConfig::AbstractParamDescriptionConstPtr(new DynParamConfig::ParamDescription<int>("combination_method", "int", 0, "", "{'enum_description': 'x', 'enum': [{'srcline': 8, 'description': 'I can do it', 'srcfile': '/home/dlu/bnr_software/src/bnr_autonomy/bnr_navigation/dyn_param_error/cfg/DynParam.cfg', 'cconsttype': 'const int', 'value': 0, 'ctype': 'int', 'type': 'int', 'name': 'A'}, {'srcline': 9, 'description': "I can't do it", 'srcfile': '/home/dlu/bnr_software/src/bnr_autonomy/bnr_navigation/dyn_param_error/cfg/DynParam.cfg', 'cconsttype': 'const int', 'value': 0, 'ctype': 'int', 'type': 'int', 'name': 'B'}]}", &DynParamConfig::combination_method)));
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           ^
/home/dlu/bnr_software/devel/include/dyn_param_error/DynParamConfig.h:387:494: warning: multi-character character constant [-Wmultichar]
       Default.abstract_parameters.push_back(DynParamConfig::AbstractParamDescriptionConstPtr(new DynParamConfig::ParamDescription<int>("combination_method", "int", 0, "", "{'enum_description': 'x', 'enum': [{'srcline': 8, 'description': 'I can do it', 'srcfile': '/home/dlu/bnr_software/src/bnr_autonomy/bnr_navigation/dyn_param_error/cfg/DynParam.cfg', 'cconsttype': 'const int', 'value': 0, 'ctype': 'int', 'type': 'int', 'name': 'A'}, {'srcline': 9, 'description': "I can't do it", 'srcfile': '/home/dlu/bnr_software/src/bnr_autonomy/bnr_navigation/dyn_param_error/cfg/DynParam.cfg', 'cconsttype': 'const int', 'value': 0, 'ctype': 'int', 'type': 'int', 'name': 'B'}]}", &DynParamConfig::combination_method)));
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              ^
...[and many more]...
mikaelarguedas commented 7 years ago

Addressed in #74 and #76