{"thread":{"id":"29549","subject":"[PATCH] Change include order in two compat/ files to avoid compiler warning","startedAt":"2012-02-05T01:08:27Z","lastAt":"2012-02-05T22:32:21Z","messageCount":4,"participants":["Ben Walton","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"183881","messageId":"1328404107-15757-1-git-send-email-bwalton@artsci.utoronto.ca","threadId":"29549","inReplyTo":null,"subject":"[PATCH] Change include order in two compat/ files to avoid compiler warning","fromName":"Ben Walton","fromEmail":"bwalton@artsci.utoronto.ca","sentAt":"2012-02-05T01:08:27Z","receivedAt":"2012-02-05T01:08:27Z","isPatch":true,"sender":{"key":"bdwalton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/396061?v=4"},"body":"The inet_ntop and inet_pton compatibility wrapper source files\nincluded system headers before git-compat-utils.h.  This was causing a\nwarning on Solaris as _FILE_OFFSET_BITS was being redefined in\ngit-compat-utils.h.  Including git-compat-utils.h first avoids the\nwarnings.\n\nSigned-off-by: Ben Walton <bwalton@artsci.utoronto.ca>\n---\n\nI verified that this re-ordering doesn't affect either the build or the \ntest suite completion on both i386 and sparc.  I think the ordering is\nsimply the result of placing the git-compat-utils.h include where some\nothers were removed in da523cc597b1.\n\n compat/inet_ntop.c |    4 +---\n compat/inet_pton.c |    4 +---\n 2 files changed, 2 insertions(+), 6 deletions(-)\n\ndiff --git a/compat/inet_ntop.c b/compat/inet_ntop.c\nindex 60b5a1d..f1bf81c 100644\n--- a/compat/inet_ntop.c\n+++ b/compat/inet_ntop.c\n@@ -15,11 +15,9 @@\n  * SOFTWARE.\n  */\n \n+#include \"../git-compat-util.h\"\n #include <errno.h>\n #include <sys/types.h>\n-\n-#include \"../git-compat-util.h\"\n-\n #include <stdio.h>\n #include <string.h>\n \ndiff --git a/compat/inet_pton.c b/compat/inet_pton.c\nindex 2ec995e..1d44a5d 100644\n--- a/compat/inet_pton.c\n+++ b/compat/inet_pton.c\n@@ -15,11 +15,9 @@\n  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n  */\n \n+#include \"../git-compat-util.h\"\n #include <errno.h>\n #include <sys/types.h>\n-\n-#include \"../git-compat-util.h\"\n-\n #include <stdio.h>\n #include <string.h>\n \n-- \n1.7.8.3\n"},{"id":"183911","messageId":"7vr4y9ggij.fsf@alter.siamese.dyndns.org","threadId":"29549","inReplyTo":"1328404107-15757-1-git-send-email-bwalton@artsci.utoronto.ca","subject":"Re: [PATCH] Change include order in two compat/ files to avoid compiler warning","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-02-05T20:41:08Z","receivedAt":"2012-02-05T20:41:08Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ben Walton <bwalton@artsci.utoronto.ca> writes:\n\n> The inet_ntop and inet_pton compatibility wrapper source files\n> included system headers before git-compat-utils.h.\n\nThanks, that is definitely a breakage.\n\n> diff --git a/compat/inet_ntop.c b/compat/inet_ntop.c\n> index 60b5a1d..f1bf81c 100644\n> --- a/compat/inet_ntop.c\n> +++ b/compat/inet_ntop.c\n> @@ -15,11 +15,9 @@\n>   * SOFTWARE.\n>   */\n>  \n> +#include \"../git-compat-util.h\"\n>  #include <errno.h>\n>  #include <sys/types.h>\n> -\n> -#include \"../git-compat-util.h\"\n> -\n>  #include <stdio.h>\n>  #include <string.h>\n\nI actually have to wonder if any of these four inclusion of the system headers\nare warranted. Wouldn't they be included as part of git-compat-util.h anyway?\n"},{"id":"183935","messageId":"1328481141-21037-1-git-send-email-bwalton@artsci.utoronto.ca","threadId":"29549","inReplyTo":"7vr4y9ggij.fsf@alter.siamese.dyndns.org","subject":"(unknown)","fromName":"Ben Walton","fromEmail":"bwalton@artsci.utoronto.ca","sentAt":"2012-02-05T22:32:20Z","receivedAt":"2012-02-05T22:32:20Z","isPatch":false,"sender":{"key":"bdwalton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/396061?v=4"},"body":"Hi Junio,\n\n> > diff --git a/compat/inet_ntop.c b/compat/inet_ntop.c\n> > index 60b5a1d..f1bf81c 100644\n> > --- a/compat/inet_ntop.c\n> > +++ b/compat/inet_ntop.c\n> > @@ -15,11 +15,9 @@\n> >   * SOFTWARE.\n> >   */\n> >\n> > +#include \"../git-compat-util.h\"\n> >  #include <errno.h>\n> >  #include <sys/types.h>\n> > -\n> > -#include \"../git-compat-util.h\"\n> > -\n> >  #include <stdio.h>\n> >  #include <string.h>\n> \n> I actually have to wonder if any of these four inclusion of the\n> system headers are warranted. Wouldn't they be included as part of\n> git-compat-util.h anyway?\n\nYes, you're correct.  Dropping the system includes is correct as\nopposed to rearranging the order.  Updated patch to follow.\n\nThanks\n-Ben\n"},{"id":"183936","messageId":"1328481141-21037-2-git-send-email-bwalton@artsci.utoronto.ca","threadId":"29549","inReplyTo":"1328481141-21037-1-git-send-email-bwalton@artsci.utoronto.ca","subject":"[PATCH] Drop system includes from inet_pton/inet_ntop compatibility wrappers","fromName":"Ben Walton","fromEmail":"bwalton@artsci.utoronto.ca","sentAt":"2012-02-05T22:32:21Z","receivedAt":"2012-02-05T22:32:21Z","isPatch":true,"sender":{"key":"bdwalton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/396061?v=4"},"body":"As both of these compatibility wrappers include git-compat-utils.h,\nall of the system includes were redundant.\n\nDropping these system includes also makes git-compat-utils.h the first\ninclude which avoids a compiler warning on Solaris due to the\nredefinition of _FILE_OFFSET_BITS.\n\nSigned-off-by: Ben Walton <bwalton@artsci.utoronto.ca>\n---\n compat/inet_ntop.c |    6 ------\n compat/inet_pton.c |    6 ------\n 2 files changed, 0 insertions(+), 12 deletions(-)\n\ndiff --git a/compat/inet_ntop.c b/compat/inet_ntop.c\nindex 60b5a1d..90b7cc4 100644\n--- a/compat/inet_ntop.c\n+++ b/compat/inet_ntop.c\n@@ -15,14 +15,8 @@\n  * SOFTWARE.\n  */\n \n-#include <errno.h>\n-#include <sys/types.h>\n-\n #include \"../git-compat-util.h\"\n \n-#include <stdio.h>\n-#include <string.h>\n-\n #ifndef NS_INADDRSZ\n #define NS_INADDRSZ\t4\n #endif\ndiff --git a/compat/inet_pton.c b/compat/inet_pton.c\nindex 2ec995e..2b9a0a4 100644\n--- a/compat/inet_pton.c\n+++ b/compat/inet_pton.c\n@@ -15,14 +15,8 @@\n  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n  */\n \n-#include <errno.h>\n-#include <sys/types.h>\n-\n #include \"../git-compat-util.h\"\n \n-#include <stdio.h>\n-#include <string.h>\n-\n #ifndef NS_INT16SZ\n #define NS_INT16SZ       2\n #endif\n-- \n1.7.5.4\n"}]}