[PATCH] D42758: Support `#pragma comment(lib, "name")` in the frontend for ELF

Paul Robinson via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 31 19:23:19 PST 2018


probinson added a comment.

In https://reviews.llvm.org/D42758#993936, @ruiu wrote:

> > I also wonder which is better `#pragma comment(lib, "m")` or `#pragma comment(lib, "m")`.
>
> Sorry, I meant `#pragma comment(lib, "m")` or `#pragma comment("lib", "m")`.


I can't swear to it but I don't think Microsoft invented `#pragma comment`.  Various IBM compilers have it, with a syntax of `#pragma comment ( <keyword> [ , "string" ] )`.  I'm not seeing a `lib` keyword specifically in the IBM docs, but being a keyword would be consistent with past practice.



================
Comment at: lib/Parse/ParsePragma.cpp:299
+      getTargetInfo().getTriple().isOSBinFormatELF()) {
     MSCommentHandler.reset(new PragmaCommentHandler(Actions));
     PP.AddPragmaHandler(MSCommentHandler.get());
----------------
PS4's binary format is ELF, so you should be able to remove the isPS4 predicate.


================
Comment at: lib/Parse/ParsePragma.cpp:382
+      getTargetInfo().getTriple().isOSBinFormatELF()) {
     PP.RemovePragmaHandler(MSCommentHandler.get());
     MSCommentHandler.reset();
----------------
Don't need isPS4, as it uses ELF.


Repository:
  rC Clang

https://reviews.llvm.org/D42758





More information about the cfe-commits mailing list