{"thread":{"id":"53329","subject":"Compilation errors in git.pu/refs/reftable-backend.c","startedAt":"2020-04-27T04:34:53Z","lastAt":"2020-04-27T23:26:38Z","messageCount":5,"participants":["Torsten Bögershausen","Han-Wen Nienhuys","Jeff King","Carlo Marcelo Arenas Belón","brian m. carlson"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"396315","messageId":"575af27b-3823-2db5-ad3b-3c6cd7a95faa@web.de","threadId":"53329","inReplyTo":null,"subject":"Compilation errors in git.pu/refs/reftable-backend.c","fromName":"Torsten Bögershausen","fromEmail":"tboegi@web.de","sentAt":"2020-04-27T04:34:43Z","receivedAt":"2020-04-27T04:34:53Z","isPatch":false,"sender":{"key":"tboegi@web.de","avatar":"https://avatars.githubusercontent.com/u/7138363?v=4"},"body":"Folks, after the integration of the reftable branch:\nMerge branch 'hn/reftable' into pu\n\nMy historic (?) compiler stumbles over this code here:\nrefs/reftable-backend.c\n   for (int i = 0; i < transaction->nr; i++) {\n\nSo I think we could easily avoid the (for int i) construction.\nThe other observation could be, why we use an \"int\", when \"nr\" is\ndefined as a size_t ?\n\nstruct ref_transaction {\n\tstruct ref_store *ref_store;\n\tstruct ref_update **updates;\n\tsize_t alloc;\n\tsize_t nr;\n\tenum ref_transaction_state state;\n\tvoid *backend_data;\n};\n\nThanks for working on Git\n"},{"id":"396327","messageId":"CAFQ2z_O7z2prvnE+v-0nzC3=2mmUBHgFVF+iRqRn-7QyRQxOqg@mail.gmail.com","threadId":"53329","inReplyTo":"575af27b-3823-2db5-ad3b-3c6cd7a95faa@web.de","subject":"Re: Compilation errors in git.pu/refs/reftable-backend.c","fromName":"Han-Wen Nienhuys","fromEmail":"hanwen@google.com","sentAt":"2020-04-27T12:05:12Z","receivedAt":"2020-04-27T12:05:28Z","isPatch":false,"sender":{"key":"hanwen@google.com","avatar":"https://avatars.githubusercontent.com/u/31547?v=4"},"body":"On Mon, Apr 27, 2020 at 6:34 AM Torsten Bögershausen <tboegi@web.de> wrote:\n>\n> Folks, after the integration of the reftable branch:\n> Merge branch 'hn/reftable' into pu\n\nthanks, I'll fix that.\n\nI don't understand why Git doesn't enforce this, though.  Couldn't\n-Wdeclaration-after-statement be added to the Makefile if the compiler\nsupported it?\n\n-- \nHan-Wen Nienhuys - Google Munich\nI work 80%. Don't expect answers from me on Fridays.\n--\n\nGoogle Germany GmbH, Erika-Mann-Strasse 33, 80636 Munich\n\nRegistergericht und -nummer: Hamburg, HRB 86891\n\nSitz der Gesellschaft: Hamburg\n\nGeschäftsführer: Paul Manicle, Halimah DeLaine Prado\n"},{"id":"396328","messageId":"20200427121328.GA1725867@coredump.intra.peff.net","threadId":"53329","inReplyTo":"CAFQ2z_O7z2prvnE+v-0nzC3=2mmUBHgFVF+iRqRn-7QyRQxOqg@mail.gmail.com","subject":"Re: Compilation errors in git.pu/refs/reftable-backend.c","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2020-04-27T12:13:28Z","receivedAt":"2020-04-27T12:13:31Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Apr 27, 2020 at 02:05:12PM +0200, Han-Wen Nienhuys wrote:\n\n> On Mon, Apr 27, 2020 at 6:34 AM Torsten Bögershausen <tboegi@web.de> wrote:\n> >\n> > Folks, after the integration of the reftable branch:\n> > Merge branch 'hn/reftable' into pu\n> \n> thanks, I'll fix that.\n> \n> I don't understand why Git doesn't enforce this, though.  Couldn't\n> -Wdeclaration-after-statement be added to the Makefile if the compiler\n> supported it?\n\nTry building with \"make DEVELOPER=1\" (or putting DEVELOPER=1 in your\nconfig.mak), which will turn on warnings and enable -Werror. See\nconfig.mak.dev for the complete list.\n\n-Peff\n"},{"id":"396332","messageId":"20200427131312.GB61348@Carlos-MBP","threadId":"53329","inReplyTo":"CAFQ2z_O7z2prvnE+v-0nzC3=2mmUBHgFVF+iRqRn-7QyRQxOqg@mail.gmail.com","subject":"Re: Compilation errors in git.pu/refs/reftable-backend.c","fromName":"Carlo Marcelo Arenas Belón","fromEmail":"carenas@gmail.com","sentAt":"2020-04-27T13:13:12Z","receivedAt":"2020-04-27T13:13:16Z","isPatch":false,"sender":{"key":"carenas@gmail.com","avatar":"https://avatars.githubusercontent.com/u/76036?v=4"},"body":"On Mon, Apr 27, 2020 at 02:05:12PM +0200, Han-Wen Nienhuys wrote:\n> \n> I don't understand why Git doesn't enforce this, though.  Couldn't\n> -Wdeclaration-after-statement be added to the Makefile if the compiler\n> supported it?\n\nnot sure if that flag will catch it, but from what I recall, that\nspecific feature was only available in C99 while git's codebase\ntargets C89 (need to build with --std=gnu89 as some GNU extensions\nare already needed).\n\nsee the \"For C programs\" section in Documentation/CodingGuidelines for\ndetails.\n\nCarlo\n"},{"id":"396403","messageId":"20200427232629.GI6421@camp.crustytoothpaste.net","threadId":"53329","inReplyTo":"20200427131312.GB61348@Carlos-MBP","subject":"Re: Compilation errors in git.pu/refs/reftable-backend.c","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-04-27T23:26:29Z","receivedAt":"2020-04-27T23:26:38Z","isPatch":false,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"On 2020-04-27 at 13:13:12, Carlo Marcelo Arenas Belón wrote:\n> On Mon, Apr 27, 2020 at 02:05:12PM +0200, Han-Wen Nienhuys wrote:\n> > \n> > I don't understand why Git doesn't enforce this, though.  Couldn't\n> > -Wdeclaration-after-statement be added to the Makefile if the compiler\n> > supported it?\n> \n> not sure if that flag will catch it, but from what I recall, that\n> specific feature was only available in C99 while git's codebase\n> targets C89 (need to build with --std=gnu89 as some GNU extensions\n> are already needed).\n\nI think we had chosen to preserve this behavior because MSVC didn't\nsupport C99.  We may wish to change our approach now that MSVC supports\na reasonable subset of it and GCC and Clang are available for almost\nevery system out there.\n\nI don't think it's unreasonable to expect folks to use a compiler\nsupporting a standard that is now more than two decades old.\n\nOf course, that doesn't affect the present series, but it is a thing we\nshould consider.\n-- \nbrian m. carlson: Houston, Texas, US\nOpenPGP: https://keybase.io/bk2204\n"}]}