2.2 Options for controlling diagnostics with armclang

A number of options control the output of diagnostics with the armclang compiler.

See Controlling Errors and Warnings in the Clang Compiler User's Manual for full details about controlling diagnostics with armclang.

The following are some of the common options that control diagnostics:

-Werror

Turn warnings into errors.

-Werror=foo

Turn warning foo into an error.

-Wno-error=foo

Leave warning foo as a warning even if -Werror is specified.

-Wfoo

Enable warning foo.

-Wno-foo

Suppress warning foo.

-w

Suppress all warnings.

-Weverything

Enable all warnings.

-Wpedantic

Generate warnings if code violates strict ISO C and ISO C++.

-pedantic

Generate warnings if code violates strict ISO C and ISO C++.

-pedantic-errors

Generate errors if code violates strict ISO C and ISO C++.

Where a message can be suppressed, the compiler provides the appropriate suppression flag in the diagnostic output.

For example, by default armclang checks the format of printf() statements to ensure that the number of % format specifiers matches the number of data arguments. The following code generates a warning:

printf("Result of %d plus %d is %d\n", a, b);
armclang --target=aarch64-arm-none-eabi -c hello.c 
hello.c:25:36: warning: more '%' conversions than data arguments [-Wformat]
  printf("Result of %d plus %d is %d\n", a, b);

To suppress this warning, use -Wno-format:

armclang --target=aarch64-arm-none-eabi -c hello.c -Wno-format
Non-ConfidentialPDF file icon PDF versionARM 100066_0608_00_en
Copyright © 2014–2017 ARM Limited or its affiliates. All rights reserved.