leathers icon indicating copy to clipboard operation
leathers copied to clipboard

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

Open davidljung opened this issue 8 years ago • 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!

davidljung avatar Feb 01 '17 21:02 davidljung

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

ruslo avatar Feb 02 '17 03:02 ruslo

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

davidljung avatar Feb 02 '17 15:02 davidljung

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

ruslo avatar Feb 05 '17 01:02 ruslo