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

g.proj: Fix -Wembedded-directive compiler warnings #2877

Merged
merged 2 commits into from
Mar 17, 2023

Conversation

nilason
Copy link
Contributor

@nilason nilason commented Mar 6, 2023

Addresses warnings with the description:

warning: embedding a directive within macro arguments has undefined behavior

"warning: embedding a directive within macro arguments has undefined behavior"
@nilason nilason added enhancement New feature or request C Related code is in C labels Mar 6, 2023
@nilason nilason added this to the 8.3.0 milestone Mar 6, 2023
Copy link
Member

@wenzeslaus wenzeslaus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correctly me if I'm mistaken, but this not only addresses a compiler warning, but it also fixes the strings for translation which cannot be constructed using using ifdefs or ifs.

@nilason
Copy link
Contributor Author

nilason commented Mar 7, 2023

Correctly me if I'm mistaken, but this not only addresses a compiler warning, but it also fixes the strings for translation which cannot be constructed using using ifdefs or ifs.

It seems to me in this case it worked as it should, in spite of the warnings, example taken from main:

#: ../general/g.proj/main.c:113
msgid ""
"Print 'flat' output with no linebreaks (applies to WKT and PROJ.4 output)"
msgstr "Ausgabe ohne Zeilenumbrüche (nur bei WKT- und PROJ.4-Ausgaben)"

#: ../general/g.proj/main.c:319
#, c-format
msgid "Only one of -%c, -%c, -%c, -%c, -%c or -%c flags may be specified"
msgstr ""
"Nur ein Schalter von  -%c, -%c, -%c, -%c, -%c oder -%c kann angegeben werden"

Either way, there is no translation for the case of HAVE_OGR not being defined (however unlikely). This depends on the settings on the machine generating the .po files. In this respect the macro condition doesn't make much sense. Alternative fix may be to reformulate the message to work for both ways. Suggestions?!
cc @neteler

@nilason
Copy link
Contributor Author

nilason commented Mar 7, 2023

On the other hand, this is not an exceptional situation. There are lots of "missing" translatable messages for different states (compiled with this or that etc.).

@nilason nilason changed the title Fix -Wembedded-directive compiler warnings g.proj: Fix -Wembedded-directive compiler warnings Mar 17, 2023
@nilason nilason merged commit 8bf08f7 into OSGeo:main Mar 17, 2023
@nilason nilason deleted the 08_ped_Wembedded-directive branch March 17, 2023 12:07
ninsbl pushed a commit to ninsbl/grass that referenced this pull request Mar 20, 2023
Addresses warnings with the description:
"warning: embedding a directive within macro arguments has undefined behavior"
neteler pushed a commit to nilason/grass that referenced this pull request Nov 7, 2023
Addresses warnings with the description:
"warning: embedding a directive within macro arguments has undefined behavior"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C Related code is in C enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants