{"thread":{"id":"27020","subject":"[PATCH 6/9] gettext.h: Avoid using a non-standard C construct","startedAt":"2011-04-07T18:41:48Z","lastAt":"2011-04-11T20:13:00Z","messageCount":5,"participants":["Ramsay Jones","Jonathan Nieder","Ævar Arnfjörð Bjarmason","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":9},"messages":[{"id":"165368","messageId":"4D9E056C.1070906@ramsay1.demon.co.uk","threadId":"27020","inReplyTo":null,"subject":"[PATCH 6/9] gettext.h: Avoid using a non-standard C construct","fromName":"Ramsay Jones","fromEmail":"ramsay@ramsay1.demon.co.uk","sentAt":"2011-04-07T18:41:48Z","receivedAt":"2011-04-07T18:41:48Z","isPatch":true,"sender":{"key":"ramsay@ramsayjones.plus.com","avatar":"https://avatars.githubusercontent.com/u/33702710?v=4"},"body":"\nIn particular, standard C does not allow a parenthesized string\nas an array initializer. Some compilers, for example GCC and MSVC,\nallow this syntax as an extension, but it is (obviously) not a\nportable construct.\n\nIn order to avoid such a construct, for example while initialising\nthe array 'ignore_error' (builtin/add.c line 309), we simply\nremove the parenthesis from the definition of the N_() macro.\n\nSigned-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>\n---\n\nFor example, tcc can not parse this syntax.\n\nNote that sparse issues warnings like the following:\n    builtin/add.c:309:1: warning: too long initializer-string for \\\n        array of char\nwhich is actually a bug in sparse that is tickled by a parenthesized\nstring initializer (it doesn't determine the correct size of the\nstring). Again I have a patch ...\n\n gettext.h |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/gettext.h b/gettext.h\nindex 1b253b7..24d9182 100644\n--- a/gettext.h\n+++ b/gettext.h\n@@ -35,6 +35,6 @@ const char *Q_(const char *msgid, const char *plu, unsigned long n)\n }\n \n /* Mark msgid for translation but do not translate it. */\n-#define N_(msgid) (msgid)\n+#define N_(msgid) msgid\n \n #endif\n-- \n1.7.4\n"},{"id":"165381","messageId":"20110407221015.GA20080@elie","threadId":"27020","inReplyTo":"4D9E056C.1070906@ramsay1.demon.co.uk","subject":"Re: [PATCH 6/9] gettext.h: Avoid using a non-standard C construct","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2011-04-07T22:10:15Z","receivedAt":"2011-04-07T22:10:15Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Hi,\n\nRamsay Jones wrote:\n\n> +++ b/gettext.h\n> @@ -35,6 +35,6 @@ const char *Q_(const char *msgid, const char *plu, unsigned long n)\n[...]\n> -#define N_(msgid) (msgid)\n> +#define N_(msgid) msgid\n\nGood catch.  Thanks!\n\n> In particular, standard C does not allow a parenthesized string\n> as an array initializer.\n\nThe subject line seems unnecessarily vague.  Why not:\n\n\ti18n: avoid parenthesized string as array initializer\n\n\tThe syntax\n\n\t\tstatic const char ignore_error[] = (\"something\");\n\n\tis invalid C.  GCC and MSVC can parse it, but for example\n\ttcc cannot.  So remove the parenthesis from the definition\n\tof the N_() macro.\n\n\tSigned-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>\n\tAcked-by: Jonathan Nieder <jrnieder@gmail.com>\n"},{"id":"165543","messageId":"BANLkTimFQjbf6pz7upcb=QJngZdPTgWLmQ@mail.gmail.com","threadId":"27020","inReplyTo":"20110407221015.GA20080@elie","subject":"Re: [PATCH 6/9] gettext.h: Avoid using a non-standard C construct","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2011-04-10T12:54:15Z","receivedAt":"2011-04-10T12:54:15Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"On Fri, Apr 8, 2011 at 00:10, Jonathan Nieder <jrnieder@gmail.com> wrote:\n> Hi,\n>\n> Ramsay Jones wrote:\n>\n>> +++ b/gettext.h\n>> @@ -35,6 +35,6 @@ const char *Q_(const char *msgid, const char *plu, unsigned long n)\n> [...]\n>> -#define N_(msgid) (msgid)\n>> +#define N_(msgid) msgid\n>\n> Good catch.  Thanks!\n>\n>> In particular, standard C does not allow a parenthesized string\n>> as an array initializer.\n>\n> The subject line seems unnecessarily vague.  Why not:\n>\n>        i18n: avoid parenthesized string as array initializer\n>\n>        The syntax\n>\n>                static const char ignore_error[] = (\"something\");\n>\n>        is invalid C.  GCC and MSVC can parse it, but for example\n>        tcc cannot.  So remove the parenthesis from the definition\n>        of the N_() macro.\n>\n>        Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>\n>        Acked-by: Jonathan Nieder <jrnieder@gmail.com>\n\nThis looks good to me with this commit message:\n\nAcked-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n"},{"id":"165638","messageId":"4DA33735.5070402@ramsay1.demon.co.uk","threadId":"27020","inReplyTo":"20110407221015.GA20080@elie","subject":"Re: [PATCH 6/9] gettext.h: Avoid using a non-standard C construct","fromName":"Ramsay Jones","fromEmail":"ramsay@ramsay1.demon.co.uk","sentAt":"2011-04-11T17:15:33Z","receivedAt":"2011-04-11T17:15:33Z","isPatch":true,"sender":{"key":"ramsay@ramsayjones.plus.com","avatar":"https://avatars.githubusercontent.com/u/33702710?v=4"},"body":"Jonathan Nieder wrote:\n>> +++ b/gettext.h\n>> @@ -35,6 +35,6 @@ const char *Q_(const char *msgid, const char *plu, unsigned long n)\n> [...]\n>> -#define N_(msgid) (msgid)\n>> +#define N_(msgid) msgid\n> \n> Good catch.  Thanks!\n> \n>> In particular, standard C does not allow a parenthesized string\n>> as an array initializer.\n> \n> The subject line seems unnecessarily vague.  Why not:\n> \n> \ti18n: avoid parenthesized string as array initializer\n> \n> \tThe syntax\n> \n> \t\tstatic const char ignore_error[] = (\"something\");\n> \n> \tis invalid C.  GCC and MSVC can parse it, but for example\n> \ttcc cannot.  So remove the parenthesis from the definition\n> \tof the N_() macro.\n> \n> \tSigned-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>\n> \tAcked-by: Jonathan Nieder <jrnieder@gmail.com>\n> \n\nSounds good to me. I'll re-roll and use your message verbatim.\n\nThanks!\n\nATB,\nRamsay Jones\n"},{"id":"165646","messageId":"7v1v18wnqr.fsf@alter.siamese.dyndns.org","threadId":"27020","inReplyTo":"4DA33735.5070402@ramsay1.demon.co.uk","subject":"Re: [PATCH 6/9] gettext.h: Avoid using a non-standard C construct","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-04-11T20:13:00Z","receivedAt":"2011-04-11T20:13:00Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ramsay Jones <ramsay@ramsay1.demon.co.uk> writes:\n\n>> \tSigned-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>\n>> \tAcked-by: Jonathan Nieder <jrnieder@gmail.com>\n>> \n>\n> Sounds good to me. I'll re-roll and use your message verbatim.\n\nThanks, all.  No need to resend, as I'll be queuing what we got in 'pu'\nafter amending it.\n"}]}