gnu.cfg: Use function configuration for `_()` instead of define.

There can be preprocessor issues if the macro is used slightly different
or preprocessor conditions are used inside the string argument.
So now a function configuration with very few assumptions is used.
It is assumed that the function does return and has one parameter.
The same configuration is added for N_() since it works similar.
This commit is contained in:
versat 2019-04-03 16:02:55 +02:00
parent 20814d37d0
commit e0e262ae25
1 changed files with 12 additions and 1 deletions

View File

@ -951,7 +951,18 @@
</function>
<!-- _(string) is often defined as gettext(string) or string somewhere in projects. -->
<!-- See https://www.gnu.org/software/gettext//manual/html_node/Mark-Keywords.html -->
<define name="_(string)" value="string"/>
<!-- <define name="_(string)" value="string"/> does not work always, so use a very conservative
function configuration instead if nothing else is seen by Cppcheck -->
<function name="_">
<noreturn>false</noreturn>
<arg nr="1"/>
</function>
<!-- For N_ often something like "#define N_(String) gettext_noop (String)" is used. To be safe
a conservative function configuration is used here like for "_" -->
<function name="N_">
<noreturn>false</noreturn>
<arg nr="1"/>
</function>
<!-- https://linux.die.net/man/3/dgettext -->
<!-- char * dgettext (const char *domainname, const char *msgid); -->
<function name="dgettext">