Re: CMake on Unix
Timofei Zhakov <[email protected]> Tue, 19 May 2026 19:10:45 +0200
| Newsgroups | gmane.comp.apache.apr.devel |
|---|---|
| Message-ID | <CAPD1kXRrTY+7JSCpBL6wfryLN7gt+3baHfjGsMLVrSHYUxBnuQ@mail.gmail.com> |
--000000000000b5a86106522ec440 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, May 19, 2026 at 5:02=E2=80=AFPM Branko =C4=8Cibej <[email protected]= > wrote: > On 19. 5. 26 15:19, Timofei Zhakov wrote: > > On Mon, May 18, 2026 at 11:20=E2=80=AFPM Branko =C4=8Cibej <brane@apache.= org> wrote: > >> On 18. 5. 26 22:27, Ivan Zhakov wrote: >> >> On Mon, 18 May 2026 at 21:24, Timofei Zhakov <[email protected]> wrote: >> >>> On Mon, May 18, 2026 at 5:22=E2=80=AFPM Branko =C4=8Cibej <brane@apache= .org> wrote: >>> >>>> On 18. 5. 26 17:04, Ivan Zhakov wrote: >>>> >>>> >>> [..] >> >>> Yes, especially because the Unix and Win32 versions share a lot of >>> things in common but sometimes need to do it in a slightly different wa= y. >>> >>> Also what do you guys think about the fact that Win32 apr.h includes >>> windows.h? It seems odd to me. APR promises to eliminate platform >>> dependence by wrapping everything into POSIX-ish style API >>> >> >> Cross-platform API. I'm not sure what you mean by POSIX-ish, but APR >> isn't that. >> >> > I mean that the API is similar. For example, apr_file_open() kind of work= s > almost like fopen(). Not exactly but in my head I have this connection. > Okay their signatures are very different and even naming, but I think the= re > is some pattern of doing the same thing but in a slightly more modern way > with a bit more control. > > >> without extra unneeded junk and then all high level code essentially has >>> GetLastError in the scope. I think if one wants to explicitly use win32 >>> API, they should include those headers themselves. >>> >> >> It's a good question. I agree that apr.h should not depend on system >> headers like Windows.h. But one reason that Windows error codes are used= in >> apr_errno.h. >> >> >> apr.h is a generated, *system-specific* header. Of course it can and >> should depend on system headers if it needs them. It also includes >> sys/types.h and sys/socket.h and sys/wait.h and os2.h and so on, dependi= ng >> on the target. That makes perfect sense. >> >> > The question I have is whether we really want it or not. > > In reality it's always included in every source file. Take svn_wc.h for > example: > > [[[ > #include <apr.h> > #include <apr_pools.h> > #include <apr_tables.h> > #include <apr_hash.h> > #include <apr_time.h> > #include <apr_file_io.h> > > #include "svn_types.h" > #include "svn_string.h" > #include "svn_checksum.h" > #include "svn_io.h" > #include "svn_delta.h" /* for svn_stream_t */ > #include "svn_opt.h" > #include "svn_ra.h" /* for svn_ra_reporter_t type */ > ]]] > > > > You'll have to be more specific: what exactly is wrong with that? apr.h > uses symbols defined in windows.h, what else is it supposed to do? I real= ly > don't understand your objections. > > It shouldn't use any symbols from it. That's what I'm saying. However, there are a few places that currently potentially do use it: [[[ #if APR_HAS_UNICODE_FS /* An arbitrary size that is digestable. True max is a bit less than 32000 */ #define APR_PATH_MAX 8192 #else /* !APR_HAS_UNICODE_FS */ #define APR_PATH_MAX MAX_PATH #endif ]]] and [[[ /* Appears in later flavors, not the originals. */ #ifndef in_addr6 #define in6_addr in_addr6 #endif #ifndef WS2TCPIP_INLINE #define IN6_IS_ADDR_V4MAPPED(a) \ ( (*(const apr_uint64_t *)(const void *)(&(a)->s6_addr[0]) =3D=3D 0) = \ && (*(const apr_uint32_t *)(const void *)(&(a)->s6_addr[8]) =3D=3D ntohl(0x0000ffff))) #endif ]]] (MAX_PATH, ntohl, in_addr6 are the ones affected) I really think those should be somewhere in private headers or in the sources. MAX_PATH is fine. But ipv6 magic - I don't like it. Then we basically just have a header that nobody uses. It also brings a lot of stuff into the autocomplete. --=20 Timofei Zhakov --000000000000b5a86106522ec440 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr"><div dir=3D"ltr">On Tue, May 19, 2026 at 5:02=E2=80=AFPM B= ranko =C4=8Cibej <<a href=3D"mailto:[email protected]">[email protected]</= a>> wrote:</div><div class=3D"gmail_quote gmail_quote_container"><blockq= uote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1p= x solid rgb(204,204,204);padding-left:1ex"><u></u> =20 =20 =20 <div> <div>On 19. 5. 26 15:19, Timofei Zhakov wrote:<br> </div> <blockquote type=3D"cite"> =20 <div dir=3D"ltr"> <div dir=3D"ltr">On Mon, May 18, 2026 at 11:20=E2=80=AFPM Branko = =C4=8Cibej <<a href=3D"mailto:[email protected]" target=3D"_blank">brane@a= pache.org</a>> wrote:</div> <div class=3D"gmail_quote"> <blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8= ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> <div> <div>On 18. 5. 26 22:27, Ivan Zhakov wrote:<br> </div> <blockquote type=3D"cite"> <div dir=3D"ltr"> <div dir=3D"ltr">On Mon, 18 May 2026 at 21:24, Timofei Zhakov <<a href=3D"mailto:[email protected]" target= =3D"_blank">[email protected]</a>> wrote:</div> <div class=3D"gmail_quote"> <blockquote class=3D"gmail_quote" style=3D"margin:0px 0= px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> <div dir=3D"ltr"> <div dir=3D"ltr"> <div dir=3D"ltr">On Mon, May 18, 2026 at 5:22=E2= =80=AFPM Branko =C4=8Cibej <<a href=3D"mailto:brane@a= pache.org" target=3D"_blank">[email protected]</a>> wrote:</div> <div class=3D"gmail_quote"> <blockquote class=3D"gmail_quote" style=3D"marg= in:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1e= x"> <div> <div>On 18. 5. 26 17:04, Ivan Zhakov wrote:<br> </div> =C2=A0</div> </blockquote> </div> </div> </div> </blockquote> <div>[..]=C2=A0</div> <blockquote class=3D"gmail_quote" style=3D"margin:0px 0= px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> <div dir=3D"ltr"> <div dir=3D"ltr"> <div class=3D"gmail_quote"> <div>Yes, especially because the Unix and Win32 versions share a lot of things in common but sometimes need to do it in a slightly different way.</div> <div><br> </div> <div>Also what do you guys think about the fact that Win32 apr.h includes windows.h? It seems odd to me. APR promises to eliminate platform dependence by wrapping everything into POSIX-ish style API</div> </div> </div> </div> </blockquote> </div> </div> </blockquote> <br> Cross-platform API. I'm not sure what you mean by POSIX-ish, but APR isn't that.<br> <br> </div> </blockquote> <div><br> </div> <div>I mean that the API is similar. For example, apr_file_open() kind of works almost like fopen(). Not exactly but in my head I have this connection. Okay their signatures are very different and even naming, but I think there is some pattern of doing the same thing but in a slightly more modern way with a bit more control.</div> <div>=C2=A0</div> <blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8= ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> <div> <blockquote type=3D"cite"> <div dir=3D"ltr"> <div class=3D"gmail_quote"> <blockquote class=3D"gmail_quote" style=3D"margin:0px 0= px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> <div dir=3D"ltr"> <div dir=3D"ltr"> <div class=3D"gmail_quote"> <div>without extra unneeded junk and then all high level code essentially has GetLastError in the scope. I think if one wants to explicitly use win32 API, they should include those headers themselves.</div= > </div> </div> </div> </blockquote> <br> </div> <div class=3D"gmail_quote">It's a good question. I ag= ree that apr.h should not depend on system headers like Windows.h. But one reason that Windows error codes are used in apr_errno.h.</div> </div> </blockquote> <br> apr.h is a generated, <i>system-specific</i> header. Of course it can and should depend on system headers if it needs them. It also includes sys/types.h and sys/socket.h and sys/wait.h and os2.h and so on, depending on the target. That makes perfect sense.<br> <br> </div> </blockquote> <div><br> </div> <div>The question I have is whether we really want it or not.=C2= =A0</div> <div><br> </div> <div>In reality it's always included in every source file. Take svn_wc.h for example:</div> <div><br> </div> <div>[[[</div> <div>#include <apr.h><br> #include <apr_pools.h><br> #include <apr_tables.h><br> #include <apr_hash.h><br> #include <apr_time.h><br> #include <apr_file_io.h><br> <br> #include "svn_types.h"<br> #include "svn_string.h"<br> #include "svn_checksum.h"<br> #include "svn_io.h"<br> #include "svn_delta.h" =C2=A0 =C2=A0 /* for svn_strea= m_t */<br> #include "svn_opt.h"<br> #include "svn_ra.h" =C2=A0 =C2=A0 =C2=A0 =C2=A0/* for= svn_ra_reporter_t type */<br> ]]]</div> </div> </div> </blockquote> <br> <br> You'll have to be more specific: what exactly is wrong with that? apr.h uses symbols defined in windows.h, what else is it supposed to do? I really don't understand your objections.<br> <br></div></blockquote><div><br></div><div>It shouldn't use any sym= bols from it. That's what I'm saying.=C2=A0</div></div><div><br></d= iv><div>However, there are a few places that currently potentially do use i= t:</div><div><br></div><div>[[[</div><div>#if APR_HAS_UNICODE_FS<br>/* An a= rbitrary size that is digestable. True max is a bit less than 32000 */<br>#= define APR_PATH_MAX 8192<br>#else /* !APR_HAS_UNICODE_FS */<br>#define APR_= PATH_MAX MAX_PATH<br>#endif<br>]]]</div><div><br></div><div>and</div><div><= br></div><div>[[[</div><div>/* Appears in later flavors, not the originals.= */<br>#ifndef in_addr6<br>#define =C2=A0in6_addr =C2=A0 =C2=A0in_addr6<br>= #endif<br><br>#ifndef WS2TCPIP_INLINE<br>#define IN6_IS_ADDR_V4MAPPED(a) \<= br>=C2=A0 =C2=A0 ( =C2=A0 (*(const apr_uint64_t *)(const void *)(&(a)-&= gt;s6_addr[0]) =3D=3D 0) \<br>=C2=A0 =C2=A0 =C2=A0&& (*(const apr_u= int32_t *)(const void *)(&(a)->s6_addr[8]) =3D=3D ntohl(0x0000ffff))= )<br>#endif<br>]]]</div><div><br></div><div>(MAX_PATH,=C2=A0ntohl, in_addr6= are the ones affected)</div><div><br></div><div>I really think those shoul= d be somewhere in private headers or in the sources.=C2=A0MAX_PATH is fine.= But ipv6 magic - I don't like it.</div><div><br></div><div>Then we bas= ically just have a header that nobody uses. It also brings a lot of stuff i= nto the autocomplete.</div><br><span class=3D"gmail_signature_prefix">-- </= span><br><div dir=3D"ltr" class=3D"gmail_signature"><div dir=3D"ltr"><div>T= imofei Zhakov</div></div></div></div> --000000000000b5a86106522ec440--