Unverified Commit 581e9d7d authored by Jeff Bailey's avatar Jeff Bailey Committed by GitHub
Browse files

[libc][NFC] Remove <sys/mman.h> from mmap.h and fix tests (#195240)

Removed the last direct <sys/mman.h> include from mmap.h, replacing it
with hdr/types/size_t.h and hdr/types/off_t.h.

Added hdr/sys_mman_macros.h to test files that relied on transitive
includes for PROT_READ, MAP_ANONYMOUS, and similar macros.
parent c9140eb1
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -9,8 +9,9 @@
#ifndef LLVM_LIBC_SRC_SYS_MMAN_MMAP_H
#define LLVM_LIBC_SRC_SYS_MMAN_MMAP_H

#include "hdr/types/off_t.h"
#include "hdr/types/size_t.h"
#include "src/__support/macros/config.h"
#include <sys/mman.h> // For size_t and off_t

namespace LIBC_NAMESPACE_DECL {

+2 −0
Original line number Diff line number Diff line
@@ -50,6 +50,7 @@ add_integration_test(
  DEPENDS
    libc.hdr.time_macros
    libc.hdr.errno_macros
    libc.hdr.sys_mman_macros
    libc.include.pthread
    libc.src.pthread.pthread_rwlock_destroy
    libc.src.pthread.pthread_rwlock_init
@@ -262,6 +263,7 @@ add_integration_test(
  SRCS
    pthread_create_test.cpp
  DEPENDS
    libc.hdr.sys_mman_macros
    libc.include.pthread
    libc.src.errno.errno
    libc.src.pthread.pthread_create
+1 −0
Original line number Diff line number Diff line
@@ -6,6 +6,7 @@
//
//===----------------------------------------------------------------------===//

#include "hdr/sys_mman_macros.h"
#include "src/pthread/pthread_attr_destroy.h"
#include "src/pthread/pthread_attr_getdetachstate.h"
#include "src/pthread/pthread_attr_getguardsize.h"
+1 −0
Original line number Diff line number Diff line
@@ -7,6 +7,7 @@
//===----------------------------------------------------------------------===//

#include "hdr/errno_macros.h"
#include "hdr/sys_mman_macros.h"
#include "hdr/time_macros.h"
#include "src/__support/CPP/atomic.h"
#include "src/__support/CPP/new.h"
+1 −0
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@ add_integration_test(
  SRCS
    tls_test.cpp
  DEPENDS
    libc.hdr.sys_mman_macros
    libc.include.sys_mman
    libc.src.errno.errno
    libc.src.sys.mman.mmap
Loading