llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.77k stars 11.9k forks source link

modernize-use-using breaks certain function pointer types with macros #37846

Open PeterFeicht opened 6 years ago

PeterFeicht commented 6 years ago
Bugzilla Link 38498
Version unspecified
OS Linux
Depends On llvm/llvm-project#33760
CC @AaronBallman,@EugeneZelenko,@steveire

Extended Description

clang-tidy version: 6.0.0

While replacing macros with their definitions (which is wrong, see bug 34412), clang-tidy breaks function pointer types badly. See the following example:

define CDECL __attribute((cdecl))

// BEFORE typedef void (CDECL FuncType)(int a); // AFTER using FuncType = void ()(int) attribute((cdecl)))(int a); // should be using FuncType = void (CDECL *)(int a);

I don't know if this only happens when the macro contains an attribute (what with the parentheses), but I don't know what else I'd want to put in there.

steveire commented 5 years ago

Also noted in llvm/llvm-bugzilla-archive#39329

though some of the cases there have been worked-around since.

llvmbot commented 1 week ago

@llvm/issue-subscribers-bug

Author: Peter Feichtinger (PeterFeicht)

| | | | --- | --- | | Bugzilla Link | [38498](https://llvm.org/bz38498) | | Version | unspecified | | OS | Linux | | Depends On | llvm/llvm-project#33760 | | CC | @AaronBallman,@EugeneZelenko,@steveire | ## Extended Description clang-tidy version: 6.0.0 While replacing macros with their definitions (which is wrong, see bug 34412), clang-tidy breaks function pointer types badly. See the following example: #define CDECL __attribute((cdecl)) // BEFORE typedef void (CDECL *FuncType)(int a); // AFTER using FuncType = void (*)(int) __attribute__((cdecl)))(int a); // should be using FuncType = void (CDECL *)(int a); I don't know if this only happens when the macro contains an attribute (what with the parentheses), but I don't know what else I'd want to put in there.