I have included the RETableview manager library from POD. I need to remove the warnings currently I am getting. What are the best ways of receiving the updates
You can use surpress a lot of warning generated from clang from either build options or in your code. For instance, if you had a unused variable you didn't want to keep getting warned about, you could do this:
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-variable"
let a = 1;
#pragma clang diagnostic pop
The basic idea is to edit compiler diagnostics and then restore them. When your source file is compiled it will basically ignore that line from a diagnostic perspective. You can do a lot more with the pragma marks as well, check out clang's user manual.
Related
I'm using Clang 3.8 to compile one file that comes from a different source in a project. This is a temporary crutch, as this file is an addition to a library that I also use, and the code it has will be part of that library's next release. However, these people develop with less stringent warning flags than I do.
I'm not interested in these warnings as they're benign, I don't maintain that file, and it'll go away within a few months. Of course, I can selectively remove a warning or two, but I think that it makes more sense in this case to disable all and every warnings that it generates because I could change the warning settings of my project later and more occurrences could come out of it.
I've tried #pragma clang diagnostic ignored "-Weverything", but Clang warns that -Weverything is an unknown warning group.
How can I ask Clang to not generate any warnings for that file?
Indeed, the "-Weverything" is not a group of warnings, but just a special option passed to the compiler. Here is code that handles this case: lib/Basic/Warnings.cpp:118
You still can compile your problematic source file using slightly different rules/flags as you use for others sources:
clang -Wno-everything foo.c
However, I'd recommend to disable each warning explicitly using #pragma.
In case you disable all warnings, and then upgrade your compiler, then you may miss some new warnings, which could be important (e.g. undefined behaviour checks, security checks, etc).
Also, imagine what happens if the file is not gone after three months, but stays in the project forever.
If you need your compiler flags to be consistent between GCC and Clang, they both have the -w flag:
$ clang --help | grep -i suppress
-w Suppress all warnings
Until now in Xcode 6 I was able to suppress warnings for some external libraries by using pragma directives, like this:
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdocumentation"
#import "SwiftToObjectiveC-Swift.h"
#pragma clang diagnostic pop
Since I updated my project to Xcode 7 this directives seem to do nothing, I get all the documentation warnings that are on SwiftToObjectiveC-Swift.h.
Anyone has an idea what it could be the problem?
Thanks!
I have a ModulePass that's working with the opt tool, but I'm having trouble figuring out how to make it available to clang at the command line. My current workflow for using my pass is:
clang -c -emit-llvm [c-source code files]
llvm-link [llvm bitcode files]
opt -load [PassName].so -[pass-name] [linked llvm file]
llc [resulting bitcode file]
gcc [resulting assembler file] -o [target]
I would like to get my pass integrated with the clang command line so that it could be invoked as part of the build of existing software (e.g. c++ standard library) without having to remake the whole build system for each thing I compile. I've seen hints about how to do this, but I haven't been able to put the pieces together into a working setup.
Run an LLVM Pass Automatically with Clang describes exactly what I want, but the method appears to be deprecated in LLVM 3.4 (PassManagerBuilder has been moved to the legacy namespace).
LLVM - Run Own Pass automatically with clang seems to address the basic issue, but I was hoping I could do this without having to modify clang (which seems to be what's suggested there).
What is the best way to make a new pass available from clang using LLVM 3.4?
Clang still uses PassManagerBuilder as of 3.5 (see the PassManagerBuilderWrapper class in BackendUtil.cpp). So I believe extending it with RegisterStandardPasses, as in my blog post, is still the only way to add a pass to Clang's pass manager.
It's frustratingly difficult to find any information about how deprecated the "old" pass manager infrastructure is. But since Clang is still using it, it can't be that deprecated. :)
i want to ignore these warnings these warning appeared when i used
valid architechtures : arm64 armv7 armv7s
these type of warnings appearing in many headers .
i want to ignore these warnings just like clang does for deprecated warnings.
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
i want something like this or any compiler flags to ignore these warnings
If you go to the log navigator (the last tab on the left panel in Xcode), you can expand the "transcripts" (see View and filter logs and reports). Once you find the one that shows the build warnings, you can see what the precise -W code for each is, and then suppress it via your #pragma.
Thus, in your revised question, you show us the -W code in question is -Wobjc-property-no-attribute. Thus you could do:
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wobjc-property-no-attribute"
...
#pragma clang diagnostic pop
I use a C++ library for an iOS app. With Apple LLVM 3.1 compiler configured (default), I get a lot of warnings for this C++ code, most of them saying:
... is a GNU extension
The introduction of clang's user manual says:
The Clang driver and language features are intentionally designed to be as compatible with the GNU GCC compiler as reasonably possible, easing migration from GCC to Clang. In most cases, code "just works".
So, is it save to just look for a switch to disable this warnings (btw. how to?) or should I better get this lib rid of all GNU extensions?
You can suppress the warnings using compiler flags. Clang tells you which compiler flag to use for each warning. After a build, choose View > Navigators > Show Log Navigator. Then choose the latest build log from the log navigator. Find a file with a warning and click the disclosure button at the right end of its status line. Xcode will show you the compiler command line and output for that file. Each warning should include the compiler flag that enables the warning. Example:
In my example, the warning flag is -Wpointer-arith. So the warning can be disabled by -Wno-pointer-arith. So I could add that flag to the “Other Warning Flags” build setting: