Including <cerrno> instead of <errno.h>, does it upset POSIX?

Albert Astals Cid aacid at kde.org
Wed Apr 14 23:16:46 BST 2021


El dimecres, 14 d’abril de 2021, a les 23:28:36 (CEST), Ahmad Samir va escriure:
> On 14/04/2021 22:20, Albert Astals Cid wrote:
> > El dimecres, 14 d’abril de 2021, a les 15:13:09 (CEST), Ahmad Samir va escriure:
> >> Hello :)
> >>
> >> A week or so ago I created an MR to include <cerrno> instead of <errno.h> in KIO[1].
> >>
> >>   From /usr/include/c++/10/cerrno:
> >> /** @file cerrno
> >>    *  This is a Standard C++ Library file.  You should @c \#include this file
> >>    *  in your programs, rather than any of the @a *.h implementation files.
> >>    *
> >>    *  This is the C++ version of the Standard C Library header @c errno.h,
> >>    *  and its contents are (mostly) the same as that header, but are all
> >>    *  contained in the namespace @c std (except for names which are defined
> >>    *  as macros in C).
> >>    */
> >>
> >>
> >> And then I made similar commits to a lot of the other Frameworks (not all, since the build failed
> >> for some of them, so I left them alone).
> > 
> > I honestly didn't think this would be a problem, but you say the build of some of them failed, so i guess it is :D
> > 
> > Could you link to the particular MR's that failed?
> > 
> 
> I created one MR for KIO, once that was reviewed, I then applied similar patches to the other 
> Frameworks directly.
> 
> Fortunately, it's easy to find which ones weren't changed, grep/rg; (I excluded frameworks that are 
> going to be deprecated, kdelibs4support and kjs):
> 
> karchive/autotests/karchivetest.cpp:28:#include <errno.h>
> karchive/src/karchive.cpp:23:#include <errno.h>

I changed those and it compiles just fine here.

> 
> kdesu/src/kdesu_stub.c:31:#include <errno.h> (this is C code (guessing since I don't know C), so it 
> makes sense to leave that one in)

Yes, this is not C++

> kholidays/src/parsers/plan2/holidayscannerplan.cpp:1313:# include <errno.h>
> kholidays/src/parsers/plan2/holidayscannerplan.lpp:17:# include <errno.h>

This works too

> kinit/src/kdeinit/kinit.cpp:24:#include <errno.h>
> kinit/src/kdeinit/kinit_mac.mm:25:#include <errno.h>
> kinit/src/kdeinit/kinit_win.cpp:15:#include <errno.h>
> kinit/src/klauncher/klauncher.cpp:21:#include <errno.h>
> kinit/src/start_kdeinit/start_kdeinit.c:12:#include <errno.h>
> kinit/src/wrapper.cpp:23:#include <errno.h>

Same (obviously excluding start_kdeinit.c)

> 
> ktexteditor/src/buffer/katesecuretextbuffer.cpp:12:#include <errno.h>
> ktexteditor/src/buffer/katetextbuffer.cpp:20:#include <errno.h>

Same.

Maybe your problem was that you tried to change C files?

Cheers,
  Albert

 
> > Cheers,
> >    Albert
> > 
> 
> 
> 






More information about the Kde-frameworks-devel mailing list