From 92d29b963aca6d28b1f5b77532606144666efc7a Mon Sep 17 00:00:00 2001 From: Niels Grewe Date: Tue, 8 Sep 2015 07:37:06 +0200 Subject: [PATCH 1/6] Test travis --- .travis.yml | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..85fbc92 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,8 @@ +language: cpp +compiler: clang +script: + - mkdir build + - cd build + - cmake -DCMAKE_BUILD_TYPE=Debug .. + - cmake --build . + - cmake --build . --target test From 9c62645bf1d63ad088a0be14b070c5140eb5c304 Mon Sep 17 00:00:00 2001 From: Niels Grewe Date: Tue, 8 Sep 2015 12:04:22 +0200 Subject: [PATCH 2/6] Be more lenient when accepting property encodings produced by clang. Cf. gnustep/libobjc2#5. --- Test/PropertyIntrospectionTest2.m | 135 +++++++++++++++++++++--------- 1 file changed, 94 insertions(+), 41 deletions(-) diff --git a/Test/PropertyIntrospectionTest2.m b/Test/PropertyIntrospectionTest2.m index 9e07589..b77721d 100644 --- a/Test/PropertyIntrospectionTest2.m +++ b/Test/PropertyIntrospectionTest2.m @@ -244,6 +244,52 @@ __attribute__((objc_root_class)) #define ATTR(n, v) (objc_property_attribute_t){(n), (v)} #define ATTRS(...) (objc_property_attribute_t[]){ __VA_ARGS__ }, \ sizeof((objc_property_attribute_t[]){ __VA_ARGS__ }) / sizeof(objc_property_attribute_t) +#define OPT_ASSERT(stmt) if (abort) { \ + assert(stmt);\ +} else { \ + if (!(stmt)) { return NO; } \ +} + +static BOOL testPropertyForProperty_alt(objc_property_t p, + const char *name, + const char *types, + objc_property_attribute_t* list, + unsigned int size, BOOL abort) +{ + OPT_ASSERT(0 != p); + OPT_ASSERT(strcmp(name, property_getName(p)) == 0); + const char *attrs = property_getAttributes(p); + OPT_ASSERT(0 != attrs); + OPT_ASSERT(strcmp(types, attrs) == 0); + unsigned int attrsCount = 0; + objc_property_attribute_t *attrsList = property_copyAttributeList(p, &attrsCount); + OPT_ASSERT(0 != attrsList); + OPT_ASSERT(attrsCount == size); + for (unsigned int index=0; indexname != NULL; attrsCount++, ra++) {} + OPT_ASSERT(attrsCount == size); + free(attrsList); + for (unsigned int index=0; indexname != NULL; attrsCount++, ra++) {} - assert(attrsCount == size); - free(attrsList); - for (unsigned int index=0; index Date: Fri, 9 Oct 2015 09:47:55 +0000 Subject: [PATCH 3/6] Set the -pthread compiler flag when pthreads is used. Apparently, setting -lpthread is not enough to convince gcc to actually link a thread library, so if we are using pthreads, set the -pthread flag as well. It fixes the gcc situation and doesn't have any adverse effects for clang either. --- CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4b4f37a..26d82a8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -240,7 +240,9 @@ endif (ENABLE_OBJCXX) set(CMAKE_THREAD_PREFER_PTHREAD) include(FindThreads) set(objc_LINK_FLAGS "${objc_LINK_FLAGS} ${CMAKE_THREAD_LIBS_INIT}") - +if(CMAKE_USE_PTHREADS_INIT) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread") +endif() add_library(objc SHARED ${libobjc_C_SRCS} ${libobjc_ASM_SRCS} ${libobjc_OBJC_SRCS} ${libobjc_CXX_SRCS}) From f1c58120b99d1dd42bc8ff2d4171f208022266f5 Mon Sep 17 00:00:00 2001 From: Niels Grewe Date: Mon, 12 Oct 2015 11:58:28 +0000 Subject: [PATCH 4/6] Remove bogus workaround for build system issue --- CMakeLists.txt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 26d82a8..4b4f37a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -240,9 +240,7 @@ endif (ENABLE_OBJCXX) set(CMAKE_THREAD_PREFER_PTHREAD) include(FindThreads) set(objc_LINK_FLAGS "${objc_LINK_FLAGS} ${CMAKE_THREAD_LIBS_INIT}") -if(CMAKE_USE_PTHREADS_INIT) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread") -endif() + add_library(objc SHARED ${libobjc_C_SRCS} ${libobjc_ASM_SRCS} ${libobjc_OBJC_SRCS} ${libobjc_CXX_SRCS}) From 40b7f872e93093805f4ad6de7f2c8b0f7e8cd0a8 Mon Sep 17 00:00:00 2001 From: Niels Grewe Date: Mon, 12 Oct 2015 12:00:49 +0000 Subject: [PATCH 5/6] Also specify -march=i586 when compiling with gcc --- CMakeLists.txt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4b4f37a..83c9363 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -161,13 +161,14 @@ if (${CMAKE_C_COMPILER_ID} MATCHES Clang*) if (${CMAKE_C_COMPILER_VERSION} VERSION_GREATER 3.1) set(CMAKE_OBJC_FLAGS "${CMAKE_OBJC_FLAGS} -fobjc-runtime=gnustep-1.7") endif () - if (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "i686") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=i586") - endif () else (${CMAKE_C_COMPILER_ID} MATCHES Clang*) MESSAGE("WARNING: It is strongly recommended that you compile with clang") endif (${CMAKE_C_COMPILER_ID} MATCHES Clang*) +if (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "i686") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=i586") +endif () + set(INSTALL_TARGETS objc) set_source_files_properties( From 5a7fcc01658a6f003f125b2e63c1137da0c80e59 Mon Sep 17 00:00:00 2001 From: Niels Grewe Date: Mon, 12 Oct 2015 12:01:38 +0000 Subject: [PATCH 6/6] Remove .travis.yml for clean patch --- .travis.yml | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 85fbc92..0000000 --- a/.travis.yml +++ /dev/null @@ -1,8 +0,0 @@ -language: cpp -compiler: clang -script: - - mkdir build - - cd build - - cmake -DCMAKE_BUILD_TYPE=Debug .. - - cmake --build . - - cmake --build . --target test