LibComponentLogging-Core icon indicating copy to clipboard operation
LibComponentLogging-Core copied to clipboard

Xcode 8 build errors

Open SpacyRicochet opened this issue 8 years ago • 5 comments

The files (not installed with the Pod) currently give build errors in Xcode 8.

screen shot 2016-11-09 at 11 41 05

It looks like the main culprit is this bit of code. The complier seems to get confused about the #define cutting off the enum declaration.

// Log components, prefixed with 'lcl_c'.
enum _lcl_enum_component_t {
#   define  _lcl_component(_identifier, _header, _name)                        \
    lcl_c##_identifier,                                                        \
  __lcl_log_symbol_lcl_c##_identifier = lcl_c##_identifier,
#   include "lcl_config_components.h"
#   undef   _lcl_component

   _lcl_component_t_count,
   _lcl_component_t_first = 0,
   _lcl_component_t_last  = _lcl_component_t_count-1
};

Any idea on how to solve this?

SpacyRicochet avatar Nov 09 '16 10:11 SpacyRicochet

Strangely enough, if I change that line of code to the below code, it builds fine. Obviously, this is not ideal, since I'm not using the configuration header and just typing its again in the enumeration.

// Log components, prefixed with 'lcl_c'.
#   define  _lcl_component(_identifier, _header, _name)                \
            lcl_c##_identifier,                                        \
            __lcl_log_symbol_lcl_c##_identifier = lcl_c##_identifier,

enum _lcl_enum_component_t {
   _lcl_component(MyTracker,  "My.Tracker",  "My/Tracker")

   _lcl_component_t_count,
   _lcl_component_t_first = 0,
   _lcl_component_t_last  = _lcl_component_t_count-1
};
#   undef   _lcl_component

SpacyRicochet avatar Nov 09 '16 10:11 SpacyRicochet

Is this a module build?

aharren avatar Nov 09 '16 18:11 aharren

I'm slightly unsure on what you mean by 'module build', but to clarify; We've integrated the project to be used by one of our own internal pods, so it's a part of that Pod's code.

Integrating it as a Pod itself also didn't work, since it would't compile past needing a lcl_config_components.h file. After hacking that, it would still not compile due to the compiler error I mentioned.

SpacyRicochet avatar Nov 10 '16 15:11 SpacyRicochet

If the Pod is built as a (clang-style) module, then the macro/include mechanism doesn't work anymore, because includes are only processed once :(

aharren avatar Nov 10 '16 18:11 aharren

You might want to try the trick that was done in RestKit, they changed the component definition into 1 macro: https://github.com/RestKit/RestKit/blob/development/Code/Support/lcl_config_components_RK.h#L52-L63

aharren avatar Nov 20 '16 09:11 aharren