[haiku-commits] Re: haiku: hrev44524 - src/build/libroot

  • From: Ingo Weinhold <ingo_weinhold@xxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Mon, 13 Aug 2012 12:16:50 +0200

On 2012-08-13 at 02:34:04 [+0200], jscipione@xxxxxxxxx wrote:
> hrev44524 adds 2 changesets to branch 'master'
> old head: 7ad72ef6eae1ad8a2ec03043055ca0e649b11f80
> new head: efeef5fad7c8a92b0595540a6004113b8df8da12
> 
> ----------------------------------------------------------------------------
> 
> e4e6891: Cleanup darwin build system some more.
>   
>   * Convert fs_darwin.cpp and fs_freebsd.cpp to C.

Please revert that. There's no reason for doing so and it prevents later C++ 
use. A good deal of the libroot_build implementation (particularly the 
attributes part) makes use of C++.

[...]
> diff --git a/headers/build/host/darwin/dirent.h 
> b/headers/build/host/darwin/dirent.h
> index 296b56c..8cae5fc 100644
> --- a/headers/build/host/darwin/dirent.h
> +++ b/headers/build/host/darwin/dirent.h
> @@ -1,16 +1,12 @@
>  #ifndef _HAIKU_BUILD_COMPATIBILITY_DARWIN_DIRENT
>  #define _HAIKU_BUILD_COMPATIBILITY_DARWIN_DIRENT
>  
> -#ifdef __cplusplus
> -extern "C" {
> -#endif
> -
>  #include_next <dirent.h>
>  
> +__BEGIN_DECLS
> +

There should be two blank lines between the header guard and the includes and 
between the includes and whatever follows.

> diff --git a/headers/build/host/darwin/fcntl.h 
> b/headers/build/host/darwin/fcntl.h
> index 36810e3..ff123d3 100644
> --- a/headers/build/host/darwin/fcntl.h
> +++ b/headers/build/host/darwin/fcntl.h
> @@ -1,10 +1,6 @@
>  #ifndef _HAIKU_BUILD_COMPATIBILITY_DARWIN_FCNTL
>  #define _HAIKU_BUILD_COMPATIBILITY_DARWIN_FCNTL
>  
> -#ifdef __cplusplus
> -extern "C" {
> -#endif
> -
>  #include_next <fcntl.h>
>  #include <sys/time.h>
>  

Ditto.

> diff --git a/headers/build/host/darwin/stdio.h 
> b/headers/build/host/darwin/stdio.h
> index 0843207..c33a09d 100644
> --- a/headers/build/host/darwin/stdio.h
> +++ b/headers/build/host/darwin/stdio.h
> @@ -1,17 +1,13 @@
>  #ifndef _HAIKU_BUILD_COMPATIBILITY_DARWIN_STDIO
>  #define _HAIKU_BUILD_COMPATIBILITY_DARWIN_STDIO
>  
> -#ifdef __cplusplus
> -extern "C" {
> -#endif
> -
>  #include_next <stdio.h>
>  
> +__BEGIN_DECLS
> +

Ditto.

> diff --git a/headers/build/host/darwin/unistd.h 
> b/headers/build/host/darwin/unistd.h
> index c451674..1f4669f 100644
> --- a/headers/build/host/darwin/unistd.h
> +++ b/headers/build/host/darwin/unistd.h
> @@ -1,20 +1,16 @@
>  #ifndef _HAIKU_BUILD_COMPATIBILITY_DARWIN_UNISTD
>  #define _HAIKU_BUILD_COMPATIBILITY_DARWIN_UNISTD
>  
> -#ifdef __cplusplus
> -extern "C" {
> -#endif
> -
>  #include_next <unistd.h>
>  
> +__BEGIN_DECLS
> +

Ditto.

> diff --git a/src/build/libroot/fs_darwin.cpp b/src/build/libroot/fs_darwin.c
> similarity index 90%
> rename from src/build/libroot/fs_darwin.cpp
> rename to src/build/libroot/fs_darwin.c
> index 3bd669f..57c9fad 100644
> --- a/src/build/libroot/fs_darwin.cpp
> +++ b/src/build/libroot/fs_darwin.c
> @@ -4,7 +4,6 @@
>   * Distributed under the terms of the MIT License.
>   */
>  
> -
>  #include <dirent.h>
>  #include <errno.h>
>  #include <fcntl.h>

It was correct before.

> @@ -334,14 +333,14 @@ mknodat(int fd, const char *path, mode_t mode, dev_t 
> dev)
>  int
>  renameat(int oldFD, const char* oldPath, int newFD, const char* newPath)
>  {
> -    bool ignoreOldFD = false;
> -    bool ignoreNewFD = false;
> +    int ignoreOldFD = 0;
> +    int ignoreNewFD = 0;
>  
> -    if (oldFD == AT_FDCWD || oldPath != NULL && oldPath[0] == '/')
> -        ignoreOldFD = true;
> +    if (oldFD == AT_FDCWD || (oldPath != NULL && oldPath[0] == '/'))
> +        ignoreOldFD = 1;
>  
> -    if (newFD == AT_FDCWD || newPath != NULL && newPath[0] == '/')
> -        ignoreNewFD = true;
> +    if (newFD == AT_FDCWD || (newPath != NULL && newPath[0] == '/'))
> +        ignoreNewFD = 1;
>  
>      if (ignoreOldFD && ignoreNewFD) {
>          // call rename() ignoring the fd's

Please revert.

> @@ -465,14 +464,14 @@ linkat(int oldFD, const char *oldPath, int newFD, 
> const char *newPath,
>          return -1;
>      }
>  
> -    bool ignoreOldFD = false;
> -    bool ignoreNewFD = false;
> +    int ignoreOldFD = 0;
> +    int ignoreNewFD = 0;
>  
>      if (oldFD == AT_FDCWD || oldPath != NULL && oldPath[0] == '/')
> -        ignoreOldFD = true;
> +        ignoreOldFD = 1;
>  
>      if (newFD == AT_FDCWD || newPath != NULL && newPath[0] == '/')
> -        ignoreNewFD = true;
> +        ignoreNewFD = 1;
>  
>      if (ignoreOldFD && ignoreNewFD) {
>          // call link() ignoring the fd's

Please revert.

> ############################################################################
> 
> Revision:    hrev44524
> Commit:      efeef5fad7c8a92b0595540a6004113b8df8da12
> URL:         http://cgit.haiku-os.org/haiku/commit/?id=efeef5f
> Author:      John Scipione <jscipione@xxxxxxxxx>
> Date:        Sun Aug 12 23:32:18 2012 UTC
> 
> FreeBSD build fixes cpp => c
> 
> ----------------------------------------------------------------------------
> 
> diff --git a/src/build/libroot/fs_freebsd.c b/src/build/libroot/fs_freebsd.c
> index 1fa1c7a..9e4062c 100644
> --- a/src/build/libroot/fs_freebsd.c
> +++ b/src/build/libroot/fs_freebsd.c

Please revert.

> diff --git a/src/build/libroot/fs_freebsd.h b/src/build/libroot/fs_freebsd.h
> index 6db2712..404edb8 100644
> --- a/src/build/libroot/fs_freebsd.h
> +++ b/src/build/libroot/fs_freebsd.h
> @@ -5,13 +5,16 @@
>  #ifndef FS_FREEBSD_H
>  #define FS_FREEBSD_H
>  
> -
>  #include <sys/uio.h>

It was correct before.

CU, Ingo

Other related posts: