Are the clang C compiler's diagnostic messages (warning, errors, etc.) hard-coded, or does it provide a way to specify which language (as opposed to English) to emit them in? Could I provide a custom dictionary for it to use at runtime, without building my own clang from source?
Clang's diagnostics are currently hard-coded, but the system is designed to support localization. You can read some information about how it works here:
http://clang.llvm.org/docs/InternalsManual.html#Diagnostics
We'd really like help localizing. If this is an area that you're interested in helping out, please contact the cfe-dev mailing list!
Related
At work, I work on a C++ program which uses Cmake. In the top-level CMakeLists.txt, the CMAKE_CXX_FLAGS_DEBUG flag is set for Clang to input the different flags we want for the compilation.
My problem is that I see previous developers on the project put a lot of compilation options I don't understand for clang and I don't find them in the documentation... I don't understand why they aren't documented ! Moreover, I really wonder how the previous developers had the idea to put them in the code if they couldn't find them in the official documentation !
Here is a few examples of flags I couldn't find in the documentation :
-Wno-covered-switch-default
-Wno-exit-time-destructors
-Wno-padded
-Wweak-vtables
I need to get full Clang warnings list. With Descriptions. For iOS.
I've seen just a list of warnings here
Clang Warnings
But there is no description.
Is there any place where i can get full list of Clang warnings with the description?
I realize this is an old question, but a complete list of warnings, along with the text printed for each one, can be found in the Clang Documentation.
(Note: This answer is now outdated.)
There's a neat project that shows the flags alongside their warning messages:
https://github.com/NSHipster/fuckingclangwarnings.com
While these are not comprehensive explanations in all cases, it is very helpful, especially when you want to switch off specific warnings.
The project hasn't been updated in a while and is probably missing a few new warnings. You could also dive into Clang's source code. I haven't worked with it in a while, but I can tell you where to start:
Clone the Clang repository
Browse to /include/clang/Basic/Diagnostic.td. This file includes a couple of other .td files which contain the various warnings, though I'm not sure if all of them are publicly available, and I think their external names are prefixed, depending on their category. I suggest searching for a known warning (or its description) to solve the puzzle.
Another interesting file is /include/clang/Driver/Options.td, which includes the texts you get using the help command, if I recall correctly.
The [current] accepted answer is correct. clang/clang++'s documentation up on the website doesn't necessarily reflect the supported options in the code. As the old phrase goes, "the source code is the documentation" :/..
One thing that will help with finding options is grepping the source code for DiagGroup. For example, the following demonstrates an attempt at grepping for sign-compare, aka -Wsign-compare, using a pared down clang 7.0.1 source checkout:
$ grep --include \*.td -r sign-compare . | grep DiagGroup
tools/clang/include/clang/Basic/DiagnosticGroups.td:def SignCompare : DiagGroup<"sign-compare">;
Recently I enabled /W4 warnings (MSVC) to clean up a bit in my project and noticed that GLM uses non-standard compiler extension guarded by #define GLM_HAS_ANONYMOUS_UNION, that causes a very long warning spew.
There seems to be compiler feature detection mechanism, but I can't disable compiler extensions entirely because of Windows SDK dependencies and the /Za is discouraged as buggy anyway. So what is the proper way to disable that particular thing in GLM?
I could slap an #undef everywhere i use GLM but is there a "proper" place to configure these things, like a separate config file or something? I'm upgrading GLM from time to time so I wouldn't want to modify that define in the GLM's code.
I ran into the same problem as you.
GLM will try to use all capabilities of your compiler and if it detects VS it will use nonstandard extensions in order to do some fancy things.
If you want these non-standard things to go away (e.g. nameless unions/structs)
you can switch GLM into standard mode by using
#define GLM_FORCE_CXX11
just before you include any glm header.
I plugged this info from the manual at:
http://glm.g-truc.net/0.9.7/glm-0.9.7.pdf
Alternatively you can look into disabling this very specific warning via pragma warning push
#pragma warning(push)
#pragma warning(disable:4201) // suppress even more warnings about nameless structs
#include<glm/glm.hpp>
#pragma warning pop
more info at https://msdn.microsoft.com/en-us/library/aa273936(v=vs.60).aspx
I have just finished porting a decent amount of c-sources to the iOS platform and packaged them as a universal static framework. I, then, added the framework (not the project) to a sample iOS app in order to test linkage and proper function. That's when I ran into a humbling problem.
In my attempt to solve the problem described here, I also came across some symbols that are composed through the heavy use of macros (i HATE those). Some of those macros use function attributes that are really extensions of gcc rather than of standard C.
Of course I can always add -std=gnu89, but even then, I am not sure it will resolve the original problem of undefined symbols in the static library.
Not only that, I am now worried that my port to iOS of those sources may not be an accurate port and may result in the type of bugs/issues that maybe related to compiler's codeine and/or optimization policies.
If you can share some of your experience/advice in how best to go about that port, I would really appreciate it.
Thanks!
From manual testing with clang 8.0, it seems that both __attribute__((constructor)) and __attribute__((__constructor__)) work for your purpose.
Hi, I'm just wondering how you could obfuscate functions in iOS binary?
If you tried to reverse iOS binaries using tools like ida you will see part of the binaries have obfuscated functions like all or partly named sub_xxxxxxxx but the other have human readable functions
Someone said, add those lines to the top of your header without any further explaining:
#define SecurityClass ah7p
#define checkCopyProtection xcyc
What the methods used to secure your App?
Sorry for the dumb question, but I'm new there and I ended up with no answer explained what I need.
There are a couple of ways to obfuscate an iOS binary.
Open Source compiler named llvm-obfuscate (https://github.com/obfuscator-llvm/obfuscator/wiki) It has some nice features to obfuscate during compilation. You are replacing your default compiler with that one.
There are for Windows of course VMWare oder Themdia that can post process but that is not the case.
Besides that I just know one more which is Liasoft antispy. It is a very advanced anti analysis toolkit that allows you to encrypt functions and much more during compilation using mixed Objective-C and C++ code. ( https://www.liasoft.de/en/products/antispy/ )
Not sure if one of these is the right one for you. Except these things you are pretty lost since Objective-C is a compiled language with lots of metadata.
Hope I could help you, this is my first post.
If you only care about obfuscating method names then the easiest way is to write relevant parts of your application in C or C++. For instance, you can rewrite your SecurityClass as a C++ class instead of Objective-C class. This will not make your code reverse-engineering-proof, but it will at least raise the bar a bit. (NOTE: I'm not saying this is the right thing to do from software engineering point of view, though).
If you need to obfuscate code, then you are in a search for a tool that can do this. There are several such tools, both commercial and free. One project for doing exactly this is obfuscator-llvm.