{"thread":{"id":"60136","subject":"[REGRESSION] cache.h in 2.41.0 uses undefined macros DT_*","startedAt":"2023-08-21T12:37:17Z","lastAt":"2023-08-21T19:05:47Z","messageCount":3,"participants":["Osipov, Michael (IN IT IN)","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"480837","messageId":"627378df-4655-4a8a-abcb-c15ab6602101@siemens.com","threadId":"60136","inReplyTo":null,"subject":"[REGRESSION] cache.h in 2.41.0 uses undefined macros DT_*","fromName":"Osipov, Michael (IN IT IN)","fromEmail":"michael.osipov@siemens.com","sentAt":"2023-08-21T12:37:09Z","receivedAt":"2023-08-21T12:37:17Z","isPatch":false,"sender":{"key":"michael.osipov@siemens.com","avatar":"https://avatars.githubusercontent.com/u/573017?v=4"},"body":"Folks,\n\nI am migrating from 2.37.1 to 2.41.0 on HP-UX. My compiler gives me the \nfollowing:\n> \"cache.h\", line 147: error #2020: identifier \"DT_REG\" is undefined\n>                 return DT_REG;\n>                        ^\n> \n> \"cache.h\", line 149: error #2020: identifier \"DT_DIR\" is undefined\n>                 return DT_DIR;\n>                        ^\n> \n> \"cache.h\", line 151: error #2020: identifier \"DT_LNK\" is undefined\n>                 return DT_LNK;\n>                        ^\n> \n> \"cache.h\", line 153: error #2020: identifier \"DT_UNKNOWN\" is undefined\n>                 return DT_UNKNOWN;\n>                        ^\n> \n> 4 errors detected in the compilation of \"add-interactive.c\".\n> gmake: *** [Makefile:2715: add-interactive.o] Error 2\n\nHP-Ux does not define these non-POSIX [1] macros while dir.h perfectly \ndefines them. Tried from 2.40.0 tarball and it works flawlessly. So \nlooking at [2] it is an oversight when treewide header cleanups have \nbeen performed. Including dir.h in cache.h does not work because it will \ncause duplicate definition of struct dir_entry.\n\nFor now, I did:\n> diff -u -ur cache.h cache.h\n> --- cache.h\t2023-06-01 09:03:05 +0200\n> +++ cache.h\t2023-08-21 11:24:07 +0200\n> @@ -91,6 +91,20 @@\n>  struct pathspec;\n>  struct tree;\n>  \n> +#if defined(DT_UNKNOWN) && !defined(NO_D_TYPE_IN_DIRENT)\n> +#define DTYPE(de)\t((de)->d_type)\n> +#else\n> +#undef DT_UNKNOWN\n> +#undef DT_DIR\n> +#undef DT_REG\n> +#undef DT_LNK\n> +#define DT_UNKNOWN\t0\n> +#define DT_DIR\t\t1\n> +#define DT_REG\t\t2\n> +#define DT_LNK\t\t3\n> +#define DTYPE(de)\tDT_UNKNOWN\n> +#endif\n> +\n>  /*\n>   * Copy the sha1 and stat state of a cache entry from one to\n>   * another. But we never change the name, or the hash state!\n\nwhich is not a solution because this duplicates this block. Maybe a new \nheader file should contain these cross-used macros?\n\nAt least git now compiles and works flawlessly for me on HP-UX.\n\nRegards,\n\nMichael\n\n[1] https://stackoverflow.com/a/46694526/696632\n[2] https://github.com/git/git/compare/v2.40.0...v2.41.0\n"},{"id":"480843","messageId":"xmqqmsykqsep.fsf@gitster.g","threadId":"60136","inReplyTo":"627378df-4655-4a8a-abcb-c15ab6602101@siemens.com","subject":"Re: [REGRESSION] cache.h in 2.41.0 uses undefined macros DT_*","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2023-08-21T16:19:58Z","receivedAt":"2023-08-21T16:21:09Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"I think [*1*] on June 6th fixed it, and the fix has been in 'master'\nfor the last 2 months, and has been in the release candidate releases\nfor 2.42 that have been issued in the past weeks.\n\nThanks.\n\n[Reference]\n\n*1* https://lore.kernel.org/git/20230606205935.3183276-1-asedeno@google.com\n"},{"id":"480858","messageId":"ed291567-2c47-40f9-bcf0-89bbd6b4b49c@siemens.com","threadId":"60136","inReplyTo":"xmqqmsykqsep.fsf@gitster.g","subject":"Re: [REGRESSION] cache.h in 2.41.0 uses undefined macros DT_*","fromName":"Osipov, Michael (IN IT IN)","fromEmail":"michael.osipov@siemens.com","sentAt":"2023-08-21T19:05:25Z","receivedAt":"2023-08-21T19:05:47Z","isPatch":false,"sender":{"key":"michael.osipov@siemens.com","avatar":"https://avatars.githubusercontent.com/u/573017?v=4"},"body":"On 2023-08-21 18:19, Junio C Hamano wrote:\n> I think [*1*] on June 6th fixed it, and the fix has been in 'master'\n> for the last 2 months, and has been in the release candidate releases\n> for 2.42 that have been issued in the past weeks.\n> \n> Thanks.\n> \n> [Reference]\n> \n> *1* https://lore.kernel.org/git/20230606205935.3183276-1-asedeno@google.com\n\nThat's exactly it!\n\nJust downloaded fresh 2.42.0 release tarball and it worked instantly.\n\nIssue solved,\n\nRegards,\n\nMichael\n"}]}