ruslo/leathers

Use of Objective C/C++ gcc compiler switches for C++

davidljung opened this issue · 3 comments

Hello.
I'm just starting to use leathers and discovered that gcc (6.2.0) emits the following errors when I attempt to use #include <leathers/all>:

leathers/Source/leathers/missing-prototypes:27: error: option ‘-Wmissing-prototypes’ is valid for C/ObjC but not for C++ [-Werror=pragmas]
 # pragma GCC diagnostic ignored "-Wmissing-prototypes"
                                 ^~~~~~~~~~~~~~~~~~~~~~

leathers/Source/leathers/pointer-sign:27: error: option ‘-Wpointer-sign’ is valid for C/ObjC but not for C++ [-Werror=pragmas]
 # pragma GCC diagnostic ignored "-Wpointer-sign"
                                 ^~~~~~~~~~~~~~~~

leathers/Source/leathers/protocol:27: error: option ‘-Wprotocol’ is valid for ObjC/ObjC++ but not for C++ [-Werror=pragmas]
 # pragma GCC diagnostic ignored "-Wprotocol"
                                 ^~~~~~~~~~~~

leathers/Source/leathers/selector:27: error: option ‘-Wselector’ is valid for ObjC/ObjC++ but not for C++ [-Werror=pragmas]
 # pragma GCC diagnostic ignored "-Wselector"
                                 ^~~~~~~~~~~~

leathers/Source/leathers/strict-selector-match:27: error: option ‘-Wstrict-selector-match’ is valid for ObjC/ObjC++ but not for C++ [-Werror=pragmas]
 # pragma GCC diagnostic ignored "-Wstrict-selector-match"
                                 ^~~~~~~~~~~~~~~~~~~~~~~~~

(I'm guessing this can be fixed by just commenting out those pragmas)

Thanks!

ruslo commented

I'm guessing this can be fixed by just commenting out those pragmas

Those pragmas is the main Leathers functionality :) We should not remove them but protect with Obj-C guard instead:

#if defined(<is-this-an-obj-c-code>)
# pragma <something>
#endif

Yep (I didn't realize Leathers supported ObjC, I has assumed it was C++-only). Thanks.

ruslo commented

Leathers support both C and C++. Obj-C is an extension of C (Obj-C++ of C++). So it should work fine.