Chris Li wrote: > On 05/18/2013 12:38 AM, Christopher Li wrote: >> I guess the rules is that parenthesized string can appear in >> any place where string was allowed. > > > I create an incremental patch to address the issue. Please > check if that works for you. Unfortunately not. :( In my git repo, I just happen to be on the pu branch: $ pwd /home/ramsay/git $ git describe v1.8.3-rc3-347-gac05152 $ Using an older version of sparse (I don't know exactly which version; although I have had a patch to add --version for some years, I wasn't actually using a version with it applied!). $ make sparse >psp-out0 2>&1 $ grep warning psp-out0 | wc -l 7 $ grep error psp-out0 | wc -l 0 $ Note that the severn warnings all relate to the glibc headers using an transparent union for the various sockaddr types, for example: SP connect.c connect.c:272:40: warning: incorrect type in argument 2 (invalid types) connect.c:272:40: expected union __CONST_SOCKADDR_ARG [usertype] __addr connect.c:272:40: got struct sockaddr *ai_addr Installing a new version of sparse: $ sparse --version v0.4.5-rc1 $ make sparse >psp-out1 2>&1 $ grep warning psp-out1 | wc -l 9 $ grep error psp-out1 | wc -l 1 $ diff psp-out0 psp-out1 77a78 > notes-merge.c:111:9: warning: too long initializer-string for array of char 111a113 > sha1_file.c:54:9: warning: too long initializer-string for array of char 152a155 > compat/regex/regex_internal.c:926:1: error: symbol 're_string_context_at' redeclared with different type (originally declared at compat/regex/regex_internal.h:434) - different modifiers $ Note that the two new warnings are fixed by my first patch and the error is the second regression that I mentioned. So, now introduce an "parenthesized string initializer", thus: $ vim gettext.h $ git diff diff --git a/gettext.h b/gettext.h index 7671d09..d11a413 100644 --- a/gettext.h +++ b/gettext.h @@ -63,6 +63,6 @@ const char *Q_(const char *msgid, const char *plu, unsigned lo } /* Mark msgid for translation but do not translate it. */ -#define N_(msgid) msgid +#define N_(msgid) (msgid) #endif $ make sparse >psp-out2 2>&1 $ grep warning psp-out2 | wc -l 31 $ grep error psp-out2 | wc -l 2 $ The new warnings all look like this: $ grep warning psp-out2 | head -3 branch.c:216:1: warning: too long initializer-string for array of char branch.c:218:1: warning: too long initializer-string for array of char branch.c:220:1: warning: too long initializer-string for array of char $ The additional error is a simple syntax error: $ rm builtin/log.o $ make builtin/log.o CC builtin/log.o builtin/log.c:42: error: called object ‘"git log [<options>] [<revision range>] [[--] <path>...]\012"’ is not a function make: *** [builtin/log.o] Error 1 $ make builtin/log.sp SP builtin/log.c builtin/log.c:42:9: error: not a function <noident> $ Now install a version of sparse with my three patches applied: $ sparse --version v0.4.5-rc1-3-g14eceaa $ make sparse >psp-out3 2>&1 $ grep warning psp-out3 | wc -l 7 $ grep error psp-out3 | wc -l 2 $ So, all of the additional "too long initializer-string" warnings are no longer issued. Now add your additional patch on top: $ sparse --version v0.4.5-rc1-4-g5ef4e35 $ make sparse >psp-out4 2>&1 $ grep warning psp-out4 | wc -l 177 $ grep error psp-out4 | wc -l 2 $ All of the additional warnings, look like: $ grep warning psp-out4 | head -3 archive.c:14:9: warning: excessive elements in array initializer archive.c:221:39: warning: excessive elements in array initializer attr.c:327:9: warning: excessive elements in array initializer $ Note that the warnings don't all involve the use of the gettext 'N_' macro. Also, many (I haven't checked them all) are actually arrays of 'char *' (_not_ array of char). For example, from the above list, archive.c:221 looks like this: const char *paths[] = { path, NULL }; HTH ATB, Ramsay Jones -- To unsubscribe from this list: send the line "unsubscribe linux-sparse" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html