JavaScript is not currently enabled, but is required for full CodeSonar manual search and browse functionality.

If you are viewing this file in your hub's Web GUI, enable JavaScript in your browser: you will also need it for GUI functionality.

If you opened this file directly from disk, your browser may be directly suppressing JavaScript functionality: certain browsers perform this suppression on local files (but not files delivered by web servers) for security reasons.

CodeSonar® 28.0w AdaCore Inc
C and C++


PARSE.NONSTD.AG : Nonstandard Assigned goto

Summary

A GNU-mode source transfers control to the address stored in a pointer by writing goto *target; while strict ANSI checking is active. Computed targets after goto are not part of standard C.

Properties

Class Name Nonstandard Assigned goto
Significance style
Mnemonic PARSE.NONSTD.AG
Categories None
Availability Available for C and C++.
Enabling Checks for this warning class are disabled by default. To enable them, add the following WARNING_FILTER rule to the project configuration file.
WARNING_FILTER += allow class="Nonstandard Assigned goto"

Example

int main(void)
{
    void *target = &&done;

    goto *target; /* 'Nonstandard Assigned goto' warning issued here */

done:
    return 0;
}

int jump_fixed(void)
{
    goto done; /* ok: a direct jump needs no assigned-goto extension */
done:
    return 0;
}

To reproduce this example, analyze it with the following configuration:

WARNING_FILTER += allow class="Nonstandard Assigned goto"
# Use GCC mode so the computed-goto extension is parsed.
# Report the computed goto as a strict-conformance violation while
# retaining the GNU syntax needed to parse its label address.
EDG_FRONTEND_OPTIONS_PREPEND += --strict_warnings
gcc -c example.c

Relevant Configuration File Parameters

The following configuration file parameters affect checks for this warning class.

 

To report problems with this documentation, please visit https://support.adacore.com/csm.