no_sanitize not supported in Xcode? - xcode

Does anyone know how to disable the address sanitizer for specific functions with the clang version shipped with Xcode 7.x? It seems the function attribute no_sanitize(..) is not supported or do I miss something?
__attribute__((no_sanitize("address")))
I use XCode 7.0.2 (clang-700.1.81) based on LLVM 3.7.0.
http://llvm.org/releases/3.7.0/tools/clang/docs/AttributeReference.html#no-sanitize-clang-no-sanitize

You may be able to use no_sanitize_address instead, which appears to be supported in Apple's current version of clang (as of Xcode 7.2), e.g. the following compiles for me without any warnings:
__attribute__((no_sanitize_address)) void foo(void)
{
}

Related

How can I suppress the Xcode 7.3 warning "String literal is not a valid Objective-C selector"

I am working on a project with some of use on Xcode 7.2 and some on 7.3 (including myself). We don't want to force everyone to upgrade to 7.3 (most would also have to update their OS and we are closing in on release date).
If I use #selector() as advised by Xcode for the new syntax anyone running 7.2 is unable to compile the project as they get an error. Using Selector("…") allows the project to compile on all versions but it creates a warning that I would love to suppress (with a TODO next to it for removal once everyone has upgraded).
Is there any way to suppress this warning, or should I just live with it for now as a price of being fast to upgrade?
Update: By adding #objc before the function in question the original warning changes to Use '#selector' instead of explicitly constructing a 'Selector', and it is willing to make the change for me making the code un-compilable on Xcode 7.2 or earlier.
As the issue isn't a deprecated method neither of the two existing answers work in this case (I would use the #avaliable option to continue getting warnings about any other deprecated methods and make case-by-case decisions on each though).
There is a workaround:
#available(iOS, deprecated=10.0)
func _Selector(str: String) -> Selector {
return Selector(str)
}
But you have to use _Selector instead of Selector in your code, And I'm not sure if Apple approves of this, so before submitting to AppStore, I Suggest remove #available(iOS, deprecated=10.0).
Credit of using #available goes to Daniel Thorpe for his answer here
Isn't this working?
On your target Build settings: All
Apple LLVM Warnings - Deprecated fonctions -> NO

Can GCC output code of older version?

Can I use GCC 4.8 to provide the compilation features that were available in an older version say GCC 4.1? I have used Java and seen that we can use use JDK7 to output JDK6 compatible code, was wondering if something similar was available in GCC.

Can't get apple llvm 4.1 compiler options to show up in xcode 4.5, only llvm gcc 4.2

On most projects, If I change the compiler I'm using from "apple llvm compiler 4.1" to "llvm gcc 4.2", the compiler options available later on in Build settings will change accordingly.
Right now, I'm doing a project using objective-c++ , but I'm noticing the compiler options don't update (see screenshot below). Anyone ever experienced this? Is there a way to fix this without creating a brand new project?
I was trying to switch to the apple llvm compiler to try using ARC (and yes, I've read http://philjordan.eu/article/mixing-objective-c-c++-and-objective-c++ and it's recommendation to not use ARC in this scenario).
NOTE: I'm using Xcode Version 4.5 (4G182)
I had the same problem and solved it by editing my project.pbxproj file using a text editor. I had inconsistent settings of "GCC_VERSION" in the file. I quit Xcode and then simply deleted all the lines with GCC_VERSION in them. Restarted Xcode and suddenly I got the default compiler (apple llvm) and all the appropriate compiler options.
Click the "All" label on the top gray bar, and all the options will show up:

Precompiled C++ headers with Clang++ 2.0 (Xcode 4 Developer Preview 2)

Does anyone know if precompiled headers are supported when using Clang++ 2.0? I've installed Xcode 4 Developer Preview 2 which includes a Clang++ build that reports its version as "Apple clang version 2.0 (tags/Apple/clang-108.3))", but trying to replicate the basic PCH usage example at http://clang.llvm.org/docs/UsersManual.html#precompiledheaders for a C++ program with some STL headers in the PCH doesn't seem to work, i.e. build times are the same either way (~350ms in my case).
My guess is that PCHs for Clang++ just aren't supported fully at this stage, or for some reason you don't get much benefit from them, but maybe someone else knows more details?
The PCH created by Clang++ is ~2.5MB.
Thanks.
Looking at recent Clang commits reveals that C++ precompiled header support is present as of r110879, committed on 12 August 2010.
I checked out the LLVM and Clang sources and tested it - compile time went down by ~2.5x - nice!
This feature will no doubt make it into the next Xcode 4 prerelease/beta from Apple.

Is there a list of pragmas supported in Xcode?

Is there a list of pragmas supported in Xcode? I only know of #pragma mark. Where would I look to learn about any others?
GCC online manual, see here. Depending on your XCode settings, you can use GCC 4.0, 4.2, 4.4 (if present on your system) or even LLVM/GCC 4.2. Please refer to proper compiler version docs for specific information.

Resources