[all-commits] [llvm/llvm-project] 561c42: [libc][errno] Use macro instead of system header (...

Robin Caloudis via All-commits all-commits at lists.llvm.org
Mon May 13 14:56:25 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 561c42df5712c346d4de2e6499b06712403d3164
      https://github.com/llvm/llvm-project/commit/561c42df5712c346d4de2e6499b06712403d3164
  Author: Robin Caloudis <robin.caloudis at gmx.de>
  Date:   2024-05-13 (Mon, 13 May 2024)

  Changed paths:
    M libc/hdr/CMakeLists.txt
    A libc/hdr/errno_macros.h
    M libc/include/errno.h.def
    M libc/include/llvm-libc-macros/CMakeLists.txt
    A libc/include/llvm-libc-macros/error-number-macros.h
    M libc/include/llvm-libc-macros/generic-error-number-macros.h
    M libc/include/llvm-libc-macros/linux/CMakeLists.txt
    A libc/include/llvm-libc-macros/linux/error-number-macros.h
    A libc/include/llvm-libc-macros/linux/mips/CMakeLists.txt
    A libc/include/llvm-libc-macros/linux/mips/error-number-macros.h
    A libc/include/llvm-libc-macros/linux/sparc/CMakeLists.txt
    A libc/include/llvm-libc-macros/linux/sparc/error-number-macros.h
    M libc/src/errno/CMakeLists.txt
    M libc/src/errno/libc_errno.cpp
    M libc/src/errno/libc_errno.h

  Log Message:
  -----------
  [libc][errno] Use macro instead of system header (#91150)

## Why
Currently, the system header `errno.h` is included in `libc_errno.h`,
which is supposed to be consumed by internal implementations only. As
unit and hermetic tests should never use `#include <errno.h>` but
instead use `#include "src/errno/libc_errno.h"`, we do not want to
implicitly include `errno.h`. In order to have a clear seperation
between those two, we want to pull out the definitions of errno numbers
from `errno.h`.

## What
* Extract the definitions of errno numbers from
[include/errno.h.def](https://github.com/llvm/llvm-project/pull/91150/files#diff-ed38ed463ed50571b498a5b69039cab58dc9d145da7f751a24da9d77f07781cd)
and place it under
[include/llvm-libc-macros/linux/error-number-macros.h](https://github.com/llvm/llvm-project/pull/91150/files#diff-d6192866629690ebb7cefa1f0a90b6675073e9642f3279df08a04dcdb05fd892)
* Provide mips-specific errno numbers in
[include/llvm-libc-macros/linux/mips/error-number-macros.h](https://github.com/llvm/llvm-project/pull/91150/files#diff-3fd35a4c94e0cc359933e497b10311d857857b2e173e8afebc421b04b7527743)
* Find definition of mips errno numbers in glibc
[here](https://github.com/bminor/glibc/blob/ea73eb5f581ef5931fd67005aa0c526ba43366c9/sysdeps/unix/sysv/linux/mips/bits/errno.h#L32-L50)
(equally defined in the Linux kernel)
* Provide sparc-specific errno numbers in
[include/llvm-libc-macros/linux/sparc/error-number-macros.h](https://github.com/llvm/llvm-project/pull/91150/files#diff-5f16ffb2a51a6f72ebd4403aca7e1edea48289c99dd5978a1c84385bec4f226b)
* Find definition of sparc errno numbers in glibc
[here](https://github.com/bminor/glibc/blob/ea73eb5f581ef5931fd67005aa0c526ba43366c9/sysdeps/unix/sysv/linux/sparc/bits/errno.h#L33-L51)
(equally defined in the Linux kernel)
* Include proxy header `errno_macros.h` instead of the system header
`errno.h` in `libc_errno.h`/`libc_errno.cpp`

Closes https://github.com/llvm/llvm-project/issues/80172



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list