AutosarC++18_03-A18.0.3

The library <clocale> (locale.h) and the setlocale function shall not be used

Required inputs: IR

Rationale

A call to the setlocale function introduces a data race with other calls to setlocale function.

It may also introduce a data race with calls to functions that are affected by the current locale settings: fprintf, isprint, iswdigit, localeconv, tolower, fscanf, ispunct, iswgraph, mblen, toupper, isalnum, isspace, iswlower, mbstowcs, towlower, isalpha, isupper, iswprint, mbtowc, towupper, isblank, iswalnum, iswpunct, setlocale, wcscoll, iscntrl, iswalpha, iswspace, strcoll, wcstod, isdigit, iswblank, iswupper, strerror, wcstombs, isgraph, iswcntrl, iswxdigit, strtod, wcsxfrm, islower, iswctype, isxdigit, strxfrm, wctomb.

See Also
  • JSF December 2005 [7]: AV Rule 19 <locale.h> and the setlocale function shall not be used.

Possible Messages

Key

Text

Severity

Disabled

forbidden_libheader_symbol_use

Usage of forbidden entity from <{}>.

None

False

Options

included_headers

included_headers : bool = True

Whether the rule should also look in headers included by the configured symbol_header.
 

symbol_header

symbol_header : set[str] = set()

Name of the system or user header files of which the symbols should not be used.
 

symbols

symbols : set[bauhaus.analysis.config.QualifiedName] = {'setlocale'}

Names of symbols which are forbidden.
 

system_symbol_header

system_symbol_header : set[str] = {'locale'}

Name of the system header files of which the symbols should not be used.
 

translate_header_name

translate_header_name : bool = True

Whether to auto-translate the symbol_header (e.g. stdlib{.h} -> cstdlib).
 

user_symbol_header

user_symbol_header : set[str] = set()

Name of the user header files of which the symbols should not be used.