[libc-commits] [libc] libc: Remove `extern "C"` from main declarations (PR #102825)

David Blaikie via libc-commits libc-commits at lists.llvm.org
Mon Aug 12 13:54:27 PDT 2024


dwblaikie wrote:

> > > > Yeah - beats me. Hopefulyl someone on libc can look into this, turn off the warning, or whatnot.
> > > > Maybe one of these files puts "main" in a namespace by accident and the `extern "C"` works around this?
> > > 
> > > 
> > > It's because we compile everything with `-ffreestanding`.
> > 
> > 
> > Ah, so maybe all the `main` rules shouldn't apply when building with that mode? it looks like at least `-Wreturn-type` does this (it warns on main-without-return-statement when compiling with `-ffreestanding` but doesn't warn without that flag, so all makes sense)
> 
> I think it's because we build the tests in two configurations. One is with `-ffreestanding` during the "full build" mode, the other is a standard hosted C++ compilation for the "overlay" mode. The warning is likely only printed for the latter.

oooh :/ yeah, that'll be annoying then. Would need to use macros to enable/disable this sort of thing when building freestanding V not. Or disable the warning (-Wno-main)

https://github.com/llvm/llvm-project/pull/102825


More information about the libc-commits mailing list