git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [REGRESSION] cache.h in 2.41.0 uses undefined macros DT_*
@ 2023-08-21 12:37 Osipov, Michael (IN IT IN)
  2023-08-21 16:19 ` Junio C Hamano
  0 siblings, 1 reply; 3+ messages in thread
From: Osipov, Michael (IN IT IN) @ 2023-08-21 12:37 UTC (permalink / raw)
  To: git

Folks,

I am migrating from 2.37.1 to 2.41.0 on HP-UX. My compiler gives me the 
following:
> "cache.h", line 147: error #2020: identifier "DT_REG" is undefined
>                 return DT_REG;
>                        ^
> 
> "cache.h", line 149: error #2020: identifier "DT_DIR" is undefined
>                 return DT_DIR;
>                        ^
> 
> "cache.h", line 151: error #2020: identifier "DT_LNK" is undefined
>                 return DT_LNK;
>                        ^
> 
> "cache.h", line 153: error #2020: identifier "DT_UNKNOWN" is undefined
>                 return DT_UNKNOWN;
>                        ^
> 
> 4 errors detected in the compilation of "add-interactive.c".
> gmake: *** [Makefile:2715: add-interactive.o] Error 2

HP-Ux does not define these non-POSIX [1] macros while dir.h perfectly 
defines them. Tried from 2.40.0 tarball and it works flawlessly. So 
looking at [2] it is an oversight when treewide header cleanups have 
been performed. Including dir.h in cache.h does not work because it will 
cause duplicate definition of struct dir_entry.

For now, I did:
> diff -u -ur cache.h cache.h
> --- cache.h	2023-06-01 09:03:05 +0200
> +++ cache.h	2023-08-21 11:24:07 +0200
> @@ -91,6 +91,20 @@
>  struct pathspec;
>  struct tree;
>  
> +#if defined(DT_UNKNOWN) && !defined(NO_D_TYPE_IN_DIRENT)
> +#define DTYPE(de)	((de)->d_type)
> +#else
> +#undef DT_UNKNOWN
> +#undef DT_DIR
> +#undef DT_REG
> +#undef DT_LNK
> +#define DT_UNKNOWN	0
> +#define DT_DIR		1
> +#define DT_REG		2
> +#define DT_LNK		3
> +#define DTYPE(de)	DT_UNKNOWN
> +#endif
> +
>  /*
>   * Copy the sha1 and stat state of a cache entry from one to
>   * another. But we never change the name, or the hash state!

which is not a solution because this duplicates this block. Maybe a new 
header file should contain these cross-used macros?

At least git now compiles and works flawlessly for me on HP-UX.

Regards,

Michael

[1] https://stackoverflow.com/a/46694526/696632
[2] https://github.com/git/git/compare/v2.40.0...v2.41.0

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [REGRESSION] cache.h in 2.41.0 uses undefined macros DT_*
  2023-08-21 12:37 [REGRESSION] cache.h in 2.41.0 uses undefined macros DT_* Osipov, Michael (IN IT IN)
@ 2023-08-21 16:19 ` Junio C Hamano
  2023-08-21 19:05   ` Osipov, Michael (IN IT IN)
  0 siblings, 1 reply; 3+ messages in thread
From: Junio C Hamano @ 2023-08-21 16:19 UTC (permalink / raw)
  To: Osipov, Michael (IN IT IN); +Cc: git

I think [*1*] on June 6th fixed it, and the fix has been in 'master'
for the last 2 months, and has been in the release candidate releases
for 2.42 that have been issued in the past weeks.

Thanks.

[Reference]

*1* https://lore.kernel.org/git/20230606205935.3183276-1-asedeno@google.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [REGRESSION] cache.h in 2.41.0 uses undefined macros DT_*
  2023-08-21 16:19 ` Junio C Hamano
@ 2023-08-21 19:05   ` Osipov, Michael (IN IT IN)
  0 siblings, 0 replies; 3+ messages in thread
From: Osipov, Michael (IN IT IN) @ 2023-08-21 19:05 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

On 2023-08-21 18:19, Junio C Hamano wrote:
> I think [*1*] on June 6th fixed it, and the fix has been in 'master'
> for the last 2 months, and has been in the release candidate releases
> for 2.42 that have been issued in the past weeks.
> 
> Thanks.
> 
> [Reference]
> 
> *1* https://lore.kernel.org/git/20230606205935.3183276-1-asedeno@google.com

That's exactly it!

Just downloaded fresh 2.42.0 release tarball and it worked instantly.

Issue solved,

Regards,

Michael

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-08-21 19:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-21 12:37 [REGRESSION] cache.h in 2.41.0 uses undefined macros DT_* Osipov, Michael (IN IT IN)
2023-08-21 16:19 ` Junio C Hamano
2023-08-21 19:05   ` Osipov, Michael (IN IT IN)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).