{"thread":{"id":"49562","subject":"[RFC/PATCH] headers: normalize the spelling of some header guards","startedAt":"2018-10-14T20:14:50Z","lastAt":"2018-10-15T03:52:09Z","messageCount":5,"participants":["Ramsay Jones","brian m. carlson","Jeff King","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"360411","messageId":"2804aa4e-c078-c981-be93-27e6e58b2042@ramsayjones.plus.com","threadId":"49562","inReplyTo":null,"subject":"[RFC/PATCH] headers: normalize the spelling of some header guards","fromName":"Ramsay Jones","fromEmail":"ramsay@ramsayjones.plus.com","sentAt":"2018-10-14T20:13:09Z","receivedAt":"2018-10-14T20:14:50Z","isPatch":true,"sender":{"key":"ramsay@ramsayjones.plus.com","avatar":"https://avatars.githubusercontent.com/u/33702710?v=4"},"body":"\nSigned-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>\n---\n\nHi Junio,\n\nThis patch is marked RFC because I am not aware of any policy with\nregard to header guard spelling. Having said that, apart from the\nfetch-negotiator.h header, all of these headers are using a reserved\nidentifier (see C99 Standard 7.1.3).\n\nThese headers were found, thus:\n\n  $ git grep -n -E '^#ifn?def ' -- '*.h' | grep 'h\\:1\\:' | grep -v '^compat' | grep -v -E '[A-Z_]*_H$'\n  alias.h:1:#ifndef __ALIAS_H__\n  commit-reach.h:1:#ifndef __COMMIT_REACH_H__\n  fetch-negotiator.h:1:#ifndef FETCH_NEGOTIATOR\n  midx.h:1:#ifndef __MIDX_H__\n  t/helper/test-tool.h:1:#ifndef __TEST_TOOL_H__\n  vcs-svn/fast_export.h:1:#ifndef FAST_EXPORT_H_\n  vcs-svn/line_buffer.h:1:#ifndef LINE_BUFFER_H_\n  vcs-svn/sliding_window.h:1:#ifndef SLIDING_WINDOW_H_\n  vcs-svn/svndiff.h:1:#ifndef SVNDIFF_H_\n  vcs-svn/svndump.h:1:#ifndef SVNDUMP_H_\n  $ \n\nNote that I haven't included the headers in vcs-svn because there is\na patch being discussed which would move that directory to contrib.\n\nATB,\nRamsay Jones\n\n alias.h              | 4 ++--\n commit-reach.h       | 4 ++--\n fetch-negotiator.h   | 4 ++--\n midx.h               | 4 ++--\n t/helper/test-tool.h | 4 ++--\n 5 files changed, 10 insertions(+), 10 deletions(-)\n\ndiff --git a/alias.h b/alias.h\nindex 79933f2457..aef4843bb7 100644\n--- a/alias.h\n+++ b/alias.h\n@@ -1,5 +1,5 @@\n-#ifndef __ALIAS_H__\n-#define __ALIAS_H__\n+#ifndef ALIAS_H\n+#define ALIAS_H\n \n struct string_list;\n \ndiff --git a/commit-reach.h b/commit-reach.h\nindex 7d313e2975..122a23a24d 100644\n--- a/commit-reach.h\n+++ b/commit-reach.h\n@@ -1,5 +1,5 @@\n-#ifndef __COMMIT_REACH_H__\n-#define __COMMIT_REACH_H__\n+#ifndef COMMIT_REACH_H\n+#define COMMIT_REACH_H\n \n #include \"commit-slab.h\"\n \ndiff --git a/fetch-negotiator.h b/fetch-negotiator.h\nindex ddb44a22dc..9e3967ce66 100644\n--- a/fetch-negotiator.h\n+++ b/fetch-negotiator.h\n@@ -1,5 +1,5 @@\n-#ifndef FETCH_NEGOTIATOR\n-#define FETCH_NEGOTIATOR\n+#ifndef FETCH_NEGOTIATOR_H\n+#define FETCH_NEGOTIATOR_H\n \n struct commit;\n \ndiff --git a/midx.h b/midx.h\nindex ce80b91c68..ee83702309 100644\n--- a/midx.h\n+++ b/midx.h\n@@ -1,5 +1,5 @@\n-#ifndef __MIDX_H__\n-#define __MIDX_H__\n+#ifndef MIDX_H\n+#define MIDX_H\n \n #include \"repository.h\"\n \ndiff --git a/t/helper/test-tool.h b/t/helper/test-tool.h\nindex e4890566da..71f470b871 100644\n--- a/t/helper/test-tool.h\n+++ b/t/helper/test-tool.h\n@@ -1,5 +1,5 @@\n-#ifndef __TEST_TOOL_H__\n-#define __TEST_TOOL_H__\n+#ifndef TEST_TOOL_H\n+#define TEST_TOOL_H\n \n #include \"git-compat-util.h\"\n \n-- \n2.19.0\n"},{"id":"360436","messageId":"20181014231731.GA432229@genre.crustytoothpaste.net","threadId":"49562","inReplyTo":"2804aa4e-c078-c981-be93-27e6e58b2042@ramsayjones.plus.com","subject":"Re: [RFC/PATCH] headers: normalize the spelling of some header guards","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2018-10-14T23:17:32Z","receivedAt":"2018-10-14T23:17:42Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"On Sun, Oct 14, 2018 at 09:13:09PM +0100, Ramsay Jones wrote:\n> \n> Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>\n> ---\n> \n> Hi Junio,\n> \n> This patch is marked RFC because I am not aware of any policy with\n> regard to header guard spelling. Having said that, apart from the\n> fetch-negotiator.h header, all of these headers are using a reserved\n> identifier (see C99 Standard 7.1.3).\n> \n> These headers were found, thus:\n> \n>   $ git grep -n -E '^#ifn?def ' -- '*.h' | grep 'h\\:1\\:' | grep -v '^compat' | grep -v -E '[A-Z_]*_H$'\n>   alias.h:1:#ifndef __ALIAS_H__\n>   commit-reach.h:1:#ifndef __COMMIT_REACH_H__\n>   fetch-negotiator.h:1:#ifndef FETCH_NEGOTIATOR\n>   midx.h:1:#ifndef __MIDX_H__\n>   t/helper/test-tool.h:1:#ifndef __TEST_TOOL_H__\n>   vcs-svn/fast_export.h:1:#ifndef FAST_EXPORT_H_\n>   vcs-svn/line_buffer.h:1:#ifndef LINE_BUFFER_H_\n>   vcs-svn/sliding_window.h:1:#ifndef SLIDING_WINDOW_H_\n>   vcs-svn/svndiff.h:1:#ifndef SVNDIFF_H_\n>   vcs-svn/svndump.h:1:#ifndef SVNDUMP_H_\n> \n\nI think this is a good change.  We should definitely get rid of the\nreserved identifiers, but I'm definitely not opposed to tidying things\nup.\n-- \nbrian m. carlson: Houston, Texas, US\nOpenPGP: https://keybase.io/bk2204\n"},{"id":"360439","messageId":"20181014235950.GA13510@sigill.intra.peff.net","threadId":"49562","inReplyTo":"2804aa4e-c078-c981-be93-27e6e58b2042@ramsayjones.plus.com","subject":"Re: [RFC/PATCH] headers: normalize the spelling of some header guards","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2018-10-14T23:59:50Z","receivedAt":"2018-10-14T23:59:54Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Sun, Oct 14, 2018 at 09:13:09PM +0100, Ramsay Jones wrote:\n\n> This patch is marked RFC because I am not aware of any policy with\n> regard to header guard spelling. Having said that, apart from the\n> fetch-negotiator.h header, all of these headers are using a reserved\n> identifier (see C99 Standard 7.1.3).\n>\n> These headers were found, thus:\n> \n>   $ git grep -n -E '^#ifn?def ' -- '*.h' | grep 'h\\:1\\:' | grep -v '^compat' | grep -v -E '[A-Z_]*_H$'\n>   alias.h:1:#ifndef __ALIAS_H__\n>   commit-reach.h:1:#ifndef __COMMIT_REACH_H__\n>   fetch-negotiator.h:1:#ifndef FETCH_NEGOTIATOR\n>   midx.h:1:#ifndef __MIDX_H__\n>   t/helper/test-tool.h:1:#ifndef __TEST_TOOL_H__\n>   vcs-svn/fast_export.h:1:#ifndef FAST_EXPORT_H_\n>   vcs-svn/line_buffer.h:1:#ifndef LINE_BUFFER_H_\n>   vcs-svn/sliding_window.h:1:#ifndef SLIDING_WINDOW_H_\n>   vcs-svn/svndiff.h:1:#ifndef SVNDIFF_H_\n>   vcs-svn/svndump.h:1:#ifndef SVNDUMP_H_\n\nI think the ones with a trailing underscore are actually OK according to\nthe standard (not sure if your \"all of these\" was including the ones in\nvcs-svn ;) ).\n\nI'm in favor of normalizing even the ones that aren't illegal, though\nI'm OK either way on the vcs-svn bits if they're going away anyway.\n\n-Peff\n"},{"id":"360457","messageId":"f04c2f71-fe0f-a935-d49d-c71684b7558c@ramsayjones.plus.com","threadId":"49562","inReplyTo":"20181014235950.GA13510@sigill.intra.peff.net","subject":"Re: [RFC/PATCH] headers: normalize the spelling of some header guards","fromName":"Ramsay Jones","fromEmail":"ramsay@ramsayjones.plus.com","sentAt":"2018-10-15T00:38:14Z","receivedAt":"2018-10-15T00:38:19Z","isPatch":true,"sender":{"key":"ramsay@ramsayjones.plus.com","avatar":"https://avatars.githubusercontent.com/u/33702710?v=4"},"body":"\n\nOn 15/10/18 00:59, Jeff King wrote:\n> On Sun, Oct 14, 2018 at 09:13:09PM +0100, Ramsay Jones wrote:\n> \n>> This patch is marked RFC because I am not aware of any policy with\n>> regard to header guard spelling. Having said that, apart from the\n>> fetch-negotiator.h header, all of these headers are using a reserved\n>> identifier (see C99 Standard 7.1.3).\n>>\n>> These headers were found, thus:\n>>\n>>   $ git grep -n -E '^#ifn?def ' -- '*.h' | grep 'h\\:1\\:' | grep -v '^compat' | grep -v -E '[A-Z_]*_H$'\n>>   alias.h:1:#ifndef __ALIAS_H__\n>>   commit-reach.h:1:#ifndef __COMMIT_REACH_H__\n>>   fetch-negotiator.h:1:#ifndef FETCH_NEGOTIATOR\n>>   midx.h:1:#ifndef __MIDX_H__\n>>   t/helper/test-tool.h:1:#ifndef __TEST_TOOL_H__\n>>   vcs-svn/fast_export.h:1:#ifndef FAST_EXPORT_H_\n>>   vcs-svn/line_buffer.h:1:#ifndef LINE_BUFFER_H_\n>>   vcs-svn/sliding_window.h:1:#ifndef SLIDING_WINDOW_H_\n>>   vcs-svn/svndiff.h:1:#ifndef SVNDIFF_H_\n>>   vcs-svn/svndump.h:1:#ifndef SVNDUMP_H_\n> \n> I think the ones with a trailing underscore are actually OK according to\n> the standard (not sure if your \"all of these\" was including the ones in\n> vcs-svn ;) ).\n\nYes, trailing underscore is fine - \"all of these\" meant the\nheaders in the patch, with the noted exception of fetch-negotiator.h.\n\n> I'm in favor of normalizing even the ones that aren't illegal, though\n> I'm OK either way on the vcs-svn bits if they're going away anyway.\n\nI wasn't sure about vcs-svn, but assumed that they might go\naway soon (hence the cc: list). I will be happy to add them\nto the patch, if that is not the case.\n\nThanks.\n\nATB,\nRamsay Jones\n\n"},{"id":"360479","messageId":"xmqqmurf6f5y.fsf@gitster-ct.c.googlers.com","threadId":"49562","inReplyTo":"20181014235950.GA13510@sigill.intra.peff.net","subject":"Re: [RFC/PATCH] headers: normalize the spelling of some header guards","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2018-10-15T03:51:21Z","receivedAt":"2018-10-15T03:52:09Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> I'm in favor of normalizing even the ones that aren't illegal, though\n> I'm OK either way on the vcs-svn bits if they're going away anyway.\n\nI'm in favour of normalizing even the ones that aren't illegal, too.\n"}]}