Skip to content

Commit

Permalink
fix build issue
Browse files Browse the repository at this point in the history
  • Loading branch information
SchrodingerZhu committed Jun 16, 2024
1 parent 5f96eb8 commit 6af318b
Show file tree
Hide file tree
Showing 10 changed files with 50 additions and 4 deletions.
9 changes: 9 additions & 0 deletions libc/hdr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -115,4 +115,13 @@ add_proxy_header_library(
libc.include.float
)

add_proxy_header_library(
limits_macros
HDRS
limits_macros.h
FULL_BUILD_DEPENDS
libc.include.limits
libc.include.llvm-libc-macros.limits_macros
)

add_subdirectory(types)
22 changes: 22 additions & 0 deletions libc/hdr/limits_macros.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//===-- Definition of macros from limits.h --------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_LIBC_HDR_LIMITS_MACROS_H
#define LLVM_LIBC_HDR_LIMITS_MACROS_H

#ifdef LIBC_FULL_BUILD

#include "include/llvm-libc-macros/limits-macros.h"

#else // Overlay mode

#include <limits.h>

#endif // LLVM_LIBC_FULL_BUILD

#endif // LLVM_LIBC_HDR_LIMITS_MACROS_H
2 changes: 1 addition & 1 deletion libc/hdr/sys_stat_macros.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//===-- Definition of macros from sys/stat.h -----------------------------===//
//===-- Definition of macros from sys/stat.h ------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
Expand Down
12 changes: 12 additions & 0 deletions libc/include/llvm-libc-macros/limits-macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -225,4 +225,16 @@
#define ULLONG_MIN 0ULL
#endif // ULLONG_MIN

#ifndef _POSIX_MAX_CANON
#define _POSIX_MAX_CANON 255
#endif

#ifndef _POSIX_MAX_INPUT
#define _POSIX_MAX_INPUT 255
#endif

#ifndef _POSIX_NAME_MAX
#define _POSIX_PATH_MAX 256
#endif

#endif // LLVM_LIBC_MACROS_LIMITS_MACROS_H
3 changes: 0 additions & 3 deletions libc/include/llvm-libc-macros/linux/unistd-macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@

// TODO: Move these limit macros to a separate file
#define _POSIX_CHOWN_RESTRICTED 1
#define _POSIX_MAX_CANON 255
#define _POSIX_MAX_INPUT 255
#define _POSIX_PATH_MAX 256
#define _POSIX_PIPE_BUF 512
#define _POSIX_NO_TRUNC 1
#define _POSIX_VDISABLE '\0'
Expand Down
1 change: 1 addition & 0 deletions libc/src/unistd/linux/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,7 @@ add_object_library(
HDRS
pathconf_utils.h
DEPENDS
libc.hdr.limits_macros
libc.hdr.unistd_macros
libc.src.__support.OSUtil.osutil
libc.src.errno.errno
Expand Down
1 change: 1 addition & 0 deletions libc/src/unistd/linux/pathconf_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
// from https://elixir.bootlin.com/linux/latest/source/fs/ufs/ufs_fs.h
#define UFS_MAGIC 0x00011954
#endif
#include "hdr/limits_macros.h"
#include "hdr/unistd_macros.h"
#include <linux/limits.h> // For LINK_MAX and other limits
#include <linux/magic.h> // For common FS magics
Expand Down
2 changes: 2 additions & 0 deletions libc/test/src/unistd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,7 @@ add_libc_unittest(
SRCS
fpathconf_test.cpp
DEPENDS
libc.hdr.limits_macros
libc.hdr.unistd_macros
libc.hdr.sys_stat_macros
libc.src.unistd.fpathconf
Expand All @@ -467,6 +468,7 @@ add_libc_unittest(
SRCS
pathconf_test.cpp
DEPENDS
libc.hdr.limits_macros
libc.hdr.unistd_macros
libc.hdr.sys_stat_macros
libc.src.unistd.pathconf
Expand Down
1 change: 1 addition & 0 deletions libc/test/src/unistd/fpathconf_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
#include "hdr/fcntl_macros.h"
#include "hdr/limits_macros.h"
#include "hdr/sys_stat_macros.h"
#include "hdr/unistd_macros.h"
#include "src/fcntl/open.h"
Expand Down
1 change: 1 addition & 0 deletions libc/test/src/unistd/pathconf_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
//
//===----------------------------------------------------------------------===//
#include "hdr/fcntl_macros.h"
#include "hdr/limits_macros.h"
#include "hdr/unistd_macros.h"
#include "llvm-libc-macros/sys-stat-macros.h"
#include "src/fcntl/open.h"
Expand Down

0 comments on commit 6af318b

Please sign in to comment.