Skip to content

-Wold-style-declaration: Add diagnostic #158030

@alejandro-colomar

Description

@alejandro-colomar

Hi!

GCC has this diagnostic for obsolescent uses of storage class specifiers not the first specifier in a declaration.

typedef int ti;
int typedef it;

static int si;
int static is;
alx@debian:~/tmp$ gcc -S -Wold-style-declaration reversed.c
reversed.c:2:1: warning: ‘typedef’ is not at beginning of declaration [-Wold-style-declaration]
    2 | int typedef it;
      | ^~~
reversed.c:5:1: warning: ‘static’ is not at beginning of declaration [-Wold-style-declaration]
    5 | int static is;
      | ^~~
alx@debian:~/tmp$ clang -S -Weverything reversed.c -Wno-unused
alx@debian:~/tmp$ 

Would you mind adding this diagnostic?

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerdiverges-from:gccDoes the clang frontend diverge from gcc on this issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions