Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

clang compiler options aren't documented?

Tags:

For the sake of migrating compiler options to ARM using Xcode, I'm looking for a comprehensive documentation for clang c++ compiler/linker options. The closest I could get was this page, however:

  1. Many options aren't explained, e.g. -arch, -arch_errors_fatal, -sub_umbrella and many more.
  2. There are options in the Xcode command line that are missing in this doc, e.g. -Wno-four-char-constants, -Wshorten-64-to-32 etc.

Is there any place where I could find a full documentation with generous explanations for each option? Please note, I don't need the meaning of the options I gave here as examples, only for a comprehensive reference.

like image 906
gil_mo Avatar asked Dec 03 '20 15:12

gil_mo


1 Answers

I think that in general, you need to refer to Clang documentation and to the Cross-compilation using Clang.

Update:

  • If you cannot find the argument you need, please go to the bottom of the page to Search Page.
  • Paste the argument and press "Search".
  • If the argument is supported, you will see its description.

For example, if you look for -arch_errors_fatal it will show this:

Static analyzer report output format (html|plist|plist-multi-file|plist-html|sarif|text).

-ansi, --ansi -arch -arch_errors_fatal

It is not very descriptive but on the top of the same page, you can see:

Introduction This page lists the command line arguments currently supported by the GCC-compatible clang and clang++ drivers.

Hence, this specific flag was added for compatibility with the GCC, so you need to look for it in the GCC's documentation.

So you do the following:

  • man gcc.
  • Press /, paste -arch_errors_fatal, and press Enter. This is the search in the man page.
  • press n until you find the relevant information. For this specific flag it will show you:

-arch_errors_fatal Cause the errors having to do with files that have the wrong architecture to be fatal.

I forgot that MacOS comes without GCC nowadays, so you can lookup the GCC manual page online.

Looking for information about open-source tools might be not very straight-forward but yet feasible.

Hope it helps.

like image 69
fsquirrel Avatar answered Oct 12 '22 11:10

fsquirrel