scripts/checkpatch.pl: warn about using __FUNCTION__
PATCH 1/1 scripts/checkpatch.pl: warn about using __FUNCTION__
__FUNCTION__ is gcc specific, __func__ is C99
Signed-off-by Bartlomiej Zolnierkiewicz <[email protected]>
--- scripts/checkpatch.pl | 5 +++++ 1 file changed, 5 insertions(+)
scripts/checkpatch.pl +0 -0
@@ -1557,6 +1557,11 @@ sub process { if ($line =~ /\*\s*\)\s*k[czm]alloc\b/) { WARN("unnecessary cast may hide bugs, see
http://c-faq.com/malloc/mallocnocast.html\n" . $herecurr);
}
+
+# check for gcc specific __FUNCTION__
+ if ($line =~ /__FUNCTION__/) {
+ WARN("__func__ should be used instead of gcc specific __FUNCTION__\n" . $herecurr);
+ }
}
# In mailback mode only produce a report in the negative, for
Quoted 4 lines · Bartlomiej Zolnierkiewicz
__FUNCTION__is gcc specific,__func__is C99Signed-off-by Bartlomiej Zolnierkiewicz <[email protected]>
Research seems to indicate this is indeed sensible as __FUNCTION__ can cause -Werror to trip. Have applied this for 0.14.
Thanks.
-apw