[libc-commits] [PATCH] D155721: [libc] Warn on use of global constructors in `libc`

Joseph Huber via Phabricator via libc-commits libc-commits at lists.llvm.org
Wed Jul 19 11:27:13 PDT 2023


jhuber6 added a comment.

In D155721#4515398 <https://reviews.llvm.org/D155721#4515398>, @michaelrj wrote:

> Does this currently give any warnings for an x86_64/linux fullbuild?

Yes,

  /home/jhuber/Documents/llvm/llvm-project/libc/src/unistd/getopt.cpp:184:22: warning: declaration requires a global constructor [-Wglobal-constructors]     
    184 | static GetoptContext ctx{                                                                                   
        |                      ^  ~                                                                                 
    185 |     &impl::optarg, &impl::optind,                                                             
        |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                                                                     
    186 |     &impl::optopt, &optpos,                                                                        
        |     ~~~~~~~~~~~~~~~~~~~~~~~                                                                          
    187 |     impl::opterr,  reinterpret_cast<FILE *>(__llvm_libc::stderr)};                                          
        |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~       


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D155721/new/

https://reviews.llvm.org/D155721



More information about the libc-commits mailing list