llvm / llvm-project

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

MS pragma comment does not support idiomatic include #22456

Open 991901f3-cc14-4404-b340-165691b62a58 opened 9 years ago

991901f3-cc14-4404-b340-165691b62a58 commented 9 years ago
Bugzilla Link 22082
Version unspecified
OS All
CC @rnk

Extended Description

consider:

void f(void) {
#pragma comment(linker, "/include:"__FUNCDNAME__)
}

we will reject claiming:

pragma comment requires parenthesized identifier and optional string

MSVC accepts.

Markp2023 commented 4 months ago

Using Clang-Tidy version 17.0.3 with MSVC version 19.40.33811 I get the following error when compiling Boost:

   error: pragma comment requires parenthesized identifier and optional string [clang-diagnostic-error]`

   478 | #  pragma comment(lib, BOOST_LIB_PREFIX BOOST_STRINGIZE(BOOST_LIB_NAME) 
    "-" BOOST_LIB_TOOLSET BOOST_LIB_THREAD_OPT BOOST_LIB_RT_OPT 
    BOOST_LIB_ARCH_AND_MODEL_OPT "-" BOOST_LIB_VERSION BOOST_LIB_SUFFIX)
  |                                                                             ^
note: expanded from macro 'BOOST_LIB_TOOLSET'
44749 warnings and 1 error generated.

The project was building correctly until a recent upgrade of MSVC