{"thread":{"id":"35077","subject":"[PATCH 6/6] sparse: Fix some \"using sizeof on a function\" warnings","startedAt":"2013-10-06T20:52:21Z","lastAt":"2013-10-06T20:52:21Z","messageCount":1,"participants":["Ramsay Jones"],"isPatch":true,"patchVersion":1,"patchTotal":6},"messages":[{"id":"228591","messageId":"5251CD85.9030307@ramsay1.demon.co.uk","threadId":"35077","inReplyTo":null,"subject":"[PATCH 6/6] sparse: Fix some \"using sizeof on a function\" warnings","fromName":"Ramsay Jones","fromEmail":"ramsay@ramsay1.demon.co.uk","sentAt":"2013-10-06T20:52:21Z","receivedAt":"2013-10-06T20:52:21Z","isPatch":true,"sender":{"key":"ramsay@ramsayjones.plus.com","avatar":"https://avatars.githubusercontent.com/u/33702710?v=4"},"body":"\nSparse issues an \"using sizeof on a function\" warning for each\ncall to curl_easy_setopt() which sets an option that takes a\nfunction pointer parameter. (currently 12 such warnings over 4\nfiles.)\n\nThe warnings relate to the use of the \"typecheck-gcc.h\" header\nfile which adds a layer of type-checking macros to the curl\nfunction invocations (for gcc >= 4.3 and !__cplusplus). As part\nof the type-checking layer, 'sizeof' is applied to the function\nparameter of curl_easy_setopt(). Note that, in the context of\nsizeof, the function to function pointer conversion is not\nperformed and that sizeof(f) != sizeof(&f).\n\nA simple solution, therefore, would be to replace the function\nname in each such call to curl_easy_setopt() with an explicit\nfunction pointer expression (i.e. replace f with &f).\n\nHowever, the \"typecheck-gcc.h\" header file is only conditionally\nincluded, in addition to the gcc and C++ checks mentioned above,\ndepending on the CURL_DISABLE_TYPECHECK preprocessor variable.\n\nIn order to suppress the warnings, we use target-specific variable\nassignments to add -DCURL_DISABLE_TYPECHECK to SPARSE_FLAGS for\neach file affected (http-push.c, http.c, http-walker.c and\nremote-curl.c).\n\nSigned-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>\n---\n Makefile | 3 +++\n 1 file changed, 3 insertions(+)\n\ndiff --git a/Makefile b/Makefile\nindex de3d72c..4fde227 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -2018,6 +2018,9 @@ gettext.sp gettext.s gettext.o: GIT-PREFIX\n gettext.sp gettext.s gettext.o: EXTRA_CPPFLAGS = \\\n \t-DGIT_LOCALE_PATH='\"$(localedir_SQ)\"'\n \n+http-push.sp http.sp http-walker.sp remote-curl.sp: SPARSE_FLAGS += \\\n+\t-DCURL_DISABLE_TYPECHECK\n+\n ifdef NO_EXPAT\n http-walker.sp http-walker.s http-walker.o: EXTRA_CPPFLAGS = -DNO_EXPAT\n endif\n-- \n1.8.4\n"}]}