Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

readability-identifier-naming option MacroDefinitionCase should ignore macros passed as parameters #41605

Closed Quuxplusone closed 4 years ago

Quuxplusone commented 5 years ago
Bugzilla Link PR42635
Status RESOLVED FIXED
Importance P enhancement
Reported by Martin Lampacher (martin.lampacher@ttcontrol.com)
Reported on 2019-07-16 06:04:31 -0700
Last modified on 2020-08-11 09:08:52 -0700
Version unspecified
Hardware PC Windows NT
CC alexfh@google.com, djasper@google.com, florin@signbit.net, klimek@google.com, N.James93@hotmail.co.uk
Fixed by commit(s) rG44119626dedfebe245fe6ce26487949201299d38
Attachments
Blocks
Blocked by
See also
LLVM (http://llvm.org/):
  LLVM version 8.0.0

  Optimized build.
  Default target: x86_64-pc-linux-gnu
  Host CPU: skylake

the clang-tidy check readability-identifier-naming has an option that allows to
define the case for macros MacroDefinitionCase

> sidenote: this option is not listed in the online documentation (added
comment to https://bugs.llvm.org/show_bug.cgi?id=34990)

this check, however, also runs on parameters passed to the compilation process
via -D (as c-flags).

this is a major issue for me since most of the time i'm not in control of these
parameters. they are, e.g., part of a third party modules/configuration that i
typically exclude from clang-tidy (example: compiler definition via -
D_GNU_C_TRICORE_=1 used for AUTOSAR projects).

it would be a great enhancement if these parameters could be excluded from the
check. changing third-party code is not an option for me, completely
eliminating the naming convention for macros.
Quuxplusone commented 4 years ago

Same problem with Conan build system when using with new C++ ABI - it defines _GLIBCXX_USE_CXX11_ABI=1 on the command line.

Quuxplusone commented 4 years ago

https://reviews.llvm.org/D80631

Quuxplusone commented 4 years ago

Fixed in https://reviews.llvm.org/rG44119626dedfebe245fe6ce26487949201299d38, Thank you for reporting.

Quuxplusone commented 4 years ago

Thank you Nathan!

Quuxplusone commented 4 years ago

Don't know if this problem is in the same area or I should open a different bug report, but now we're seeing this

error: invalid case style for template parameter 'expr-type'

with both Clang10 and Clang11. It's not clear where that template is defined - I have generated the preprocessed code even. It must be in something defined inside the compiler, before the source is read.