From 06453d2a4382708bfcdc20960b757b08998c2847 Mon Sep 17 00:00:00 2001 From: "nicolai.d" Date: Wed, 18 Nov 2015 19:55:02 +0200 Subject: [PATCH 1/4] added warnings settings --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d59c374..6b38ad1 100644 --- a/README.md +++ b/README.md @@ -724,9 +724,13 @@ For example: *TODO* - ## Xcode project +*Please enable "Pedantic Warnings" to YES and use this line in "Other C flags"* +```objc +-fsanitize=undefined-trap -fsanitize-undefined-trap-on-error -Werror=objc-protocol-property-synthesis -Werror=protocol -Werror=assign-enum -Werror=objc-missing-super-calls -Werror=incompatible-pointer-types -Werror=unused-member-function -Werror=missing-selector-name -Werror=deprecated-declarations -Werror=abstract-vbase-init -Werror=atomic-property-with-user-defined-accessor -Werror=incomplete-implementation -Wunreachable-code +``` + The physical files should be kept in sync with the Xcode project files in order to avoid file sprawl. Any Xcode groups created should be reflected by folders in the filesystem. Code should be grouped not only by type, but also by feature for greater clarity. When possible, always turn on "Treat Warnings as Errors" in the target's Build Settings and enable as many [additional warnings](http://boredzo.org/blog/archives/2009-11-07/warnings) as possible. If you need to ignore a specific warning, use [Clang's pragma feature](http://clang.llvm.org/docs/UsersManual.html#controlling-diagnostics-via-pragmas). From 16ffcb842cabd88b8a36c0637f16a3b8ebe38977 Mon Sep 17 00:00:00 2001 From: "nicolai.d" Date: Wed, 18 Nov 2015 20:00:42 +0200 Subject: [PATCH 2/4] fix line delimiter --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 6b38ad1..dc9d492 100644 --- a/README.md +++ b/README.md @@ -724,6 +724,7 @@ For example: *TODO* +- ## Xcode project *Please enable "Pedantic Warnings" to YES and use this line in "Other C flags"* From 4aa632e77dbd36b28f1d7a629666efdb4413ced6 Mon Sep 17 00:00:00 2001 From: "nicolai.d" Date: Fri, 20 Nov 2015 11:20:11 +0200 Subject: [PATCH 3/4] added some sanitiser options --- README.md | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index dc9d492..a56a24e 100644 --- a/README.md +++ b/README.md @@ -727,11 +727,26 @@ For example: - ## Xcode project -*Please enable "Pedantic Warnings" to YES and use this line in "Other C flags"* +1 - compiler options +*Proposal enable "Pedantic Warnings" to YES and use this line in "Other C flags"* ```objc --fsanitize=undefined-trap -fsanitize-undefined-trap-on-error -Werror=objc-protocol-property-synthesis -Werror=protocol -Werror=assign-enum -Werror=objc-missing-super-calls -Werror=incompatible-pointer-types -Werror=unused-member-function -Werror=missing-selector-name -Werror=deprecated-declarations -Werror=abstract-vbase-init -Werror=atomic-property-with-user-defined-accessor -Werror=incomplete-implementation -Wunreachable-code +-fsanitize=address -fsanitize=undefined -fsanitize-trap=undefined -fsanitize=enum -fsanitize=float-cast-overflow -fsanitize=float-divide-by-zero -fsanitize=integer-divide-by-zero -fsanitize=nonnull-attribute -fsanitize=returns-nonnull-attribute -fsanitize=signed-integer-overflow -fsanitize=unsigned-integer-overflow -fsanitize=vla-bound -Werror=objc-protocol-property-synthesis -Werror=protocol -Werror=objc-missing-super-calls -Werror=incompatible-pointer-types -Werror=unused-member-function -Werror=missing-selector-name -Werror=deprecated-declarations -Werror=abstract-vbase-init -Werror=atomic-property-with-user-defined-accessor -Werror=incomplete-implementation -Wunreachable-code ``` +details: +about sanitize - http://clang.llvm.org/docs/UsersManual.html#controlling-code-generation +//TODO: after stable -fsanitize=memory add it to list (BUT It is not possible to combine more than one of the -fsanitize=address, -fsanitize=thread, and -fsanitize=memory checkers in the same program. The -fsanitize=undefined checks can only be combined with -fsanitize=address) + +about -Werror and -W - it have self described names ;) + + +Proposal for Objective-C++ project's: +``` +-flto -fsanitize=cfi-cast-strict -fsanitize=cfi-derived-cast -fsanitize=cfi-unrelated-cast -fsanitize=cfi-nvcall -fsanitize=cfi-vcall -fsanitize=object-size -fsanitize=return -fsanitize=vptr -fsanitize-memory-use-after-dtor +``` + + +2 - file structure The physical files should be kept in sync with the Xcode project files in order to avoid file sprawl. Any Xcode groups created should be reflected by folders in the filesystem. Code should be grouped not only by type, but also by feature for greater clarity. When possible, always turn on "Treat Warnings as Errors" in the target's Build Settings and enable as many [additional warnings](http://boredzo.org/blog/archives/2009-11-07/warnings) as possible. If you need to ignore a specific warning, use [Clang's pragma feature](http://clang.llvm.org/docs/UsersManual.html#controlling-diagnostics-via-pragmas). From 176855ba55fad838fc8aa1ea8c939aad4ccc84a0 Mon Sep 17 00:00:00 2001 From: "nicolai.d" Date: Fri, 20 Nov 2015 12:03:10 +0200 Subject: [PATCH 4/4] fix options for current compiler state in Xcode 7 --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a56a24e..2d534d4 100644 --- a/README.md +++ b/README.md @@ -730,7 +730,8 @@ For example: 1 - compiler options *Proposal enable "Pedantic Warnings" to YES and use this line in "Other C flags"* ```objc --fsanitize=address -fsanitize=undefined -fsanitize-trap=undefined -fsanitize=enum -fsanitize=float-cast-overflow -fsanitize=float-divide-by-zero -fsanitize=integer-divide-by-zero -fsanitize=nonnull-attribute -fsanitize=returns-nonnull-attribute -fsanitize=signed-integer-overflow -fsanitize=unsigned-integer-overflow -fsanitize=vla-bound -Werror=objc-protocol-property-synthesis -Werror=protocol -Werror=objc-missing-super-calls -Werror=incompatible-pointer-types -Werror=unused-member-function -Werror=missing-selector-name -Werror=deprecated-declarations -Werror=abstract-vbase-init -Werror=atomic-property-with-user-defined-accessor -Werror=incomplete-implementation -Wunreachable-code + -fsanitize=address -fsanitize=undefined-trap -fsanitize-undefined-trap-on-error -fsanitize=enum -fsanitize=float-cast-overflow -fsanitize=float-divide-by-zero -fsanitize=integer-divide-by-zero -fsanitize=signed-integer-overflow -fsanitize=vla-bound -Werror=objc-protocol-property-synthesis -Werror=protocol -Werror=objc-missing-super-calls -Werror=incompatible-pointer-types -Werror=unused-member-function -Werror=missing-selector-name -Werror=deprecated-declarations -Werror=abstract-vbase-init -Werror=atomic-property-with-user-defined-accessor -Werror=incomplete-implementation -Wunreachable-code -ferror-limit=100 -Wno-gnu-statement-expression -Wno-gnu-conditional-omitted-operand -Wno-c99-extensions + ``` details: @@ -738,7 +739,7 @@ about sanitize - http://clang.llvm.org/docs/UsersManual.html#controlling-code-ge //TODO: after stable -fsanitize=memory add it to list (BUT It is not possible to combine more than one of the -fsanitize=address, -fsanitize=thread, and -fsanitize=memory checkers in the same program. The -fsanitize=undefined checks can only be combined with -fsanitize=address) about -Werror and -W - it have self described names ;) - + -Wno for disable GNU C extensions warnings Proposal for Objective-C++ project's: ```