Debian Codegraph @

clang-tools-extra/docs/clang-tidy/checks/readability/uppercase-literal-suffix.rst

raw
1 .. title:: clang-tidy - readability-uppercase-literal-suffix
2
3 readability-uppercase-literal-suffix
4 ====================================
5
6 `cert-dcl16-c` redirects here as an alias for this check.
7 By default, only the suffixes that begin with ``l`` (``l``, ``ll``, ``lu``,
8 ``llu``, but not ``u``, ``ul``, ``ull``) are diagnosed by that alias.
9
10 `hicpp-uppercase-literal-suffix` redirects here as an alias for this check.
11
12 Detects when the integral literal or floating point (decimal or hexadecimal)
13 literal has a non-uppercase suffix and provides a fix-it hint with the uppercase
14 suffix.
15
16 All valid combinations of suffixes are supported.
17
18 .. code:: c
19
20 auto x = 1; // OK, no suffix.
21
22 auto x = 1u; // warning: integer literal suffix 'u' is not upper-case
23
24 auto x = 1U; // OK, suffix is uppercase.
25
26 ...
27
28 Options
29 -------
30
31 .. option:: NewSuffixes
32
33 Optionally, a list of the destination suffixes can be provided. When the
34 suffix is found, a case-insensitive lookup in that list is made, and if a
35 replacement is found that is different from the current suffix, then the
36 diagnostic is issued. This allows for fine-grained control of what suffixes to
37 consider and what their replacements should be.
38
39 Example
40 ^^^^^^^
41
42 Given a list `L;uL`:
43
44 * ``l`` -> ``L``
45 * ``L`` will be kept as is.
46 * ``ul`` -> ``uL``
47 * ``Ul`` -> ``uL``
48 * ``UL`` -> ``uL``
49 * ``uL`` will be kept as is.
50 * ``ull`` will be kept as is, since it is not in the list
51 * and so on.
52
53 .. option:: IgnoreMacros
54
55 If this option is set to `true` (default is `true`), the check will not warn
56 about literal suffixes inside macros.