Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GCC pragma and performance question #2193

Closed
phprus opened this issue Mar 27, 2021 · 3 comments
Closed

GCC pragma and performance question #2193

phprus opened this issue Mar 27, 2021 · 3 comments

Comments

@phprus
Copy link
Contributor

phprus commented Mar 27, 2021

Commit: 243d8be

https://gcc.gnu.org/onlinedocs/gcc-9.1.0/gcc/Function-Specific-Option-Pragmas.html:

This pragma allows you to set global optimization options for functions defined later in the source file. One or more strings can be specified. Each function that is defined after this point is treated as if it had been declared with one optimize(string) attribute for each string argument.

https://gcc.gnu.org/onlinedocs/gcc-9.1.0/gcc/Common-Function-Attributes.html:

The optimize attribute is used to specify that a function is to be compiled with different optimization options than specified on the command line.

So the attribute or pragma does override the command line?
For example, when using -O3 on the command line, the fmt code will be compiled using only the Og optimization level.

Or did I misunderstand the GCC documentation?

@vitaut
Copy link
Contributor

vitaut commented Mar 27, 2021

It will be applied only when optimizations are disabled (in separate commit).

@vitaut vitaut closed this as completed Mar 27, 2021
@vitaut
Copy link
Contributor

vitaut commented Mar 27, 2021

35c71ff

@karna48
Copy link

karna48 commented Jan 8, 2025

#4295

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants