CLang flags query:: I'm wanting to port software to FreeBSD

Charles Swiger cswiger at
Thu Feb 27 02:39:47 UTC 2014


On Feb 26, 2014, at 3:43 PM, Joe Nosay <superbisquit at> wrote:
> I've noticed different flags such as -Wno-parentheses and such along with
> the -Wno-unused-variable. I would like to know where would be a good source
> online to find the flags;

For compatibility, clang understands the commonly used -W flags that gcc uses.
More documentation is here:

...and normally folks use -Wall, -Wpedantic, or -Weverything.  However, if you truly
want the complete list, run clang's "diagtool list-warnings":

% clang/Debug+Asserts/bin/diagtool list-warnings
Warnings with flags (924):
  backslash_newline_space [-Wbackslash-newline-escape]
  escaped_newline_block_comment_end [-Wcomment]
  ext_abstract_pack_declarator_parens [-Wanonymous-pack-parens]
  ext_aggregate_init_not_constant [-Wc99-extensions]
[ ... ]
  warn_zero_size_struct_union_in_extern_c [-Wextern-c-compat]
Warnings without flags (111):
[ ... ]


  Percentage of warnings with flags: 89.28%
  Number of unique flags: 394
  Average number of diagnostics per flag: 2.345
  Number in -Wpedantic (not covered by other -W flags): 28

> and, I would like to know what flags are used by porters to optimize builds.

The default CFLAGS should be respected, unless a port needs something in particular
in order to work; see:

> These will be placed on the Makefile of the source such that it can be built natively
> on FreeBSD. I would be able to test software.

Good luck; and note that the entire porter's handbook is worth a read.  :-)


More information about the freebsd-ports mailing list