DanBloomberg / leptonica

Leptonica is an open source library containing software that is broadly useful for image processing and image analysis applications. The official github repository for Leptonica is: danbloomberg/leptonica. See leptonica.org for more documentation.
Other
1.76k stars 387 forks source link

Remove PROCNAME / procName and use __func__ #616

Closed stweil closed 2 years ago

stweil commented 2 years ago

Signed-off-by: Stefan Weil sw@weilnetz.de

stweil commented 2 years ago

This example shows how PROCNAME and procName can be removed. It could be applied to the whole code. Using __func__ automatically uses the correct function name, reduce the lines of code and avoids compiler warnings for functions which declare procName without using it.

DanBloomberg commented 2 years ago

I didn't know about func. Do you know how long that has been in effect? Big job to apply to 2700+ functions ! I could try a few files next time I feel like listening to a podcast :-)

stweil commented 2 years ago

Maybe I can help. Most changes are trivial, only some templates need special care. I now tried to update prog in pull request #617.

stweil commented 2 years ago

Do you know how long that has been in effect?

__func__ was added by the C99 standard (see https://gcc.gnu.org/onlinedocs/gcc/Function-Names.html), more than 20 years ago. Luckily it is also supported by Microsoft compilers (at least since Visual Studio 2015, see https://docs.microsoft.com/de-de/cpp/preprocessor/predefined-macros?view=msvc-140).