Keil Logo

µVISION: Activating C++11 Dynamic Syntax Checking with armclang


Information in this knowledgebase article applies to:

  • MDKv5.24a
  • ARM Compiler 6 (armclang)

Question

How can I enable C++11 Dynamic Syntax checking (DSC)?

Answer

The steps to enable C++11 syntax checking are the following:

  • Enable Dynamic Syntax Checking using the dialog Edit - Configurations - Text Completion
  • In Project => Options for Target => Target tab, set the field ARM Compiler to V6.# or higher.
    Note: C++11 dynamic syntax checking is not available with the earlier compiler, armcc.
    The highest C++ standard for syntax checking with armcc in MDK-ARM is C++03.
    
  • In Project => Options for Target => Output tab, enable Browse Information.
    Note: This step is unnecessary in MDK v5.25 or later.
    
  • In Project => Options for Target => C/C++ (AC6) tab, set the Language C++ field to c++11.
    'C++14 (community)' may also be used,
    but C++14 DSC has not been extensively tested.
    As of this writing (October 2017), C++14 standard in armclang is in [BETA] support.
    

    Now, you can view errors related to C++11 in the editor window.

  • To enable warnings, as well, go to Project => Options for Target => C/C++ (AC6) tab. Set the Warnings field to All Warnings.

You may still receive warnings concerning other C++ standards, like the following:

warning: 'constexpr' specifier is incompatible with C++98

To disable such warnings from the Misc. Controls field, copy the following:

-Wno-c++98-compat -Wno-c++98-compat-pedantic

To disable some other common warnings, you may try the following:

-Wno-global-constructors  -Wno-missing-variable-declarations

To conserve machine processing power, there is a maximum limit to the number of warnings/errors generated, per file, for dynamic syntax checking. This means that in general, armclang can issue more warnings and errors than the compiler used for syntax checking. Controlling the number of warnings per file can help extend the number of lines evaluated by DSC.

Note: The checker can react to other options in the C/C++ (AC6) tab, such as defines. The next version of the editor will also grey out code excluded by the preprocessor.

Tip: If user transitioned from ARM Compiler 5 to ARM Compiler 6, inside the same instance of the project, and AC6 syntax checking is still disabled, (i.e. View => Source Browser Window is greyed out), try closing and re-opening the project, to re-start the source browser. When a project is opened with the new DSC enabled, you will see some blue text "Creating Browse Information …" briefly appear at the bottom of the µVision IDE.

Tip: If user wants C++ code to be evaluated inside a header file, there are two ways. If a cpp file includes the header file, then it will be evaluated as C++. Alternatively, go to the Project dialog and right click on a source group folder. Add the header file as an existing file. Then in the Project dialog, right click on the file. Go to Options for File... => Properties tab => File Type field. Set the type to C++ Source file. User may receive a fatal error message, if DSC is turned on and the file type is not set to C++.

Tip: Depending on the dev machine, it may take a few seconds for the DSC to recognize a change in file type. If the user sees no change, close and re-open the header file, in the editor window, to trigger a restart of the syntax checking.

MORE INFORMATION

SEE ALSO

Last Reviewed: Thursday, June 28, 2018


Did this article provide the answer you needed?
 
Yes
No
Not Sure
 
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.