[flang-commits] [clang] [clang-tools-extra] [flang] [lldb] [llvm] [mlir] [polly] Add static to command line option (cl::opt) (PR #126243)

Rahul Joshi via flang-commits flang-commits at lists.llvm.org
Sat Feb 8 10:21:28 PST 2025


jurahul wrote:

Even if a variable is defined in the main file, it could conflict with
another one in a library being linked.

In any case, my understanding is that this is a common C++ practice,
thought I do not see it spelled out explicitly in the coding standards doc:
file scoped global variables that are not intended to be referenced outside
be marked static (or be in an anonymous namespace, but LLVM’s coding
standards disallow that). It not solving any problem, its just code cleanup.

On Sat, Feb 8, 2025 at 4:10 AM Mehdi Amini ***@***.***> wrote:

> The linked bug seems to explain it, I think?
>
> I don't actually see a description of what is the problem to solve really.
>
> It seems to be the usual "if something isn't/doesn't need to be declared
> in a header, then it should be file-local static, so as to not conflict
> with other local names in other files"?
>
> All of the files are main() file, not library files. Not clear to me what
> they would conflict with?
>
> Right, though I think @joker-eph <https://github.com/joker-eph> comment
> is that for lot of the MLIR changes, these option variables are function
> local and they need not be changed to static. This issue is only applicable
> to file scoped variables.
>
> That too :)
>
>> Reply to this email directly, view it on GitHub
> <https://github.com/llvm/llvm-project/pull/126243#issuecomment-2645273157>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/APRMUB2RRJT7RCTV5KZEII32OXXZXAVCNFSM6AAAAABWV6M2CWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMNBVGI3TGMJVG4>
> .
> You are receiving this because you commented.Message ID:
> ***@***.***>
>


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


More information about the flang-commits mailing list