Skip to content

[libc][NFC] Remove all trailing spaces from libc #82831

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions libc/AOR_v20.02/string/arm/memchr.S
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ __memchr_arm:
and r1,r1,#0xff @ Don't think we can trust the caller to actually pass a char

cmp r2,#16 @ If it's short don't bother with anything clever
blt 20f
blt 20f

tst r0, #7 @ If it's already aligned skip the next bit
beq 10f
Expand All @@ -62,7 +62,7 @@ __memchr_arm:
beq 50f @ If it matches exit found
tst r0, #7
bne 5b @ If not aligned yet then do next byte

10:
@ At this point, we are aligned, we know we have at least 8 bytes to work with
push {r4,r5,r6,r7}
Expand All @@ -71,7 +71,7 @@ __memchr_arm:
bic r4, r2, #7 @ Number of double words to work with
mvns r7, #0 @ all F's
movs r3, #0

15:
ldmia r0!,{r5,r6}
subs r4, r4, #8
Expand All @@ -87,7 +87,7 @@ __memchr_arm:
pop {r4,r5,r6,r7}
and r1,r1,#0xff @ Get r1 back to a single character from the expansion above
and r2,r2,#7 @ Leave the count remaining as the number after the double words have been done

20:
cbz r2, 40f @ 0 length or hit the end already then not found

Expand Down
2 changes: 1 addition & 1 deletion libc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ elseif(LIBC_CMAKE_VERBOSE_LOGGING)
message(STATUS "Path for config files is: ${LIBC_CONFIG_PATH}")
endif()

# option(LIBC_ENABLE_WIDE_CHARACTERS
# option(LIBC_ENABLE_WIDE_CHARACTERS
# "Whether to enable wide character functions on supported platforms. This may
# also set flags to enable or disable wide character support within other
# functions (e.g. printf)." ON)
Expand Down
4 changes: 2 additions & 2 deletions libc/benchmarks/automemcpy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ git clone https://github.com/Z3Prover/z3.git
python scripts/mk_make.py --prefix=<Z3_INSTALL_DIR>
cd build
make -j
make install
make install
```

## Configuration
Expand Down Expand Up @@ -68,7 +68,7 @@ Make sure to save the results of the benchmark as a json file.
By default, each function is benchmarked for at least one second, here we lower it to 200ms.

- `--benchmark_filter="BM_Memset|BM_Bzero"`

By default, all functions are benchmarked, here we restrict them to `memset` and `bzero`.

Other options might be useful, use `--help` for more information.
Expand Down
2 changes: 1 addition & 1 deletion libc/cmake/modules/CheckCompilerFeatures.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ foreach(feature IN LISTS ALL_COMPILER_FEATURES)
if(${feature} STREQUAL "float128")
set(LIBC_COMPILER_HAS_FLOAT128 TRUE)
elseif(${feature} STREQUAL "fixed_point")
set(LIBC_COMPILER_HAS_FIXED_POINT TRUE)
set(LIBC_COMPILER_HAS_FIXED_POINT TRUE)
endif()
endif()
endforeach()
Expand Down
2 changes: 1 addition & 1 deletion libc/cmake/modules/LLVMLibCCompileOptionRules.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ function(_get_compile_options_from_flags output_var)
endif()
check_flag(ADD_SSE4_2_FLAG ${ROUND_OPT_FLAG} ${flags})
check_flag(ADD_EXPLICIT_SIMD_OPT_FLAG ${EXPLICIT_SIMD_OPT_FLAG} ${flags})

if(LLVM_COMPILER_IS_GCC_COMPATIBLE)
if(ADD_FMA_FLAG)
if(LIBC_TARGET_ARCHITECTURE_IS_X86)
Expand Down
8 changes: 4 additions & 4 deletions libc/cmake/modules/LLVMLibCLibraryRules.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ function(add_gpu_entrypoint_library target_name base_target_name)
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/binary/${name}.gpubin"
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/binary
COMMAND ${LIBC_CLANG_OFFLOAD_PACKAGER}
"${prefix},file=$<JOIN:${object},,file=>" -o
"${prefix},file=$<JOIN:${object},,file=>" -o
${CMAKE_CURRENT_BINARY_DIR}/binary/${name}.gpubin
DEPENDS ${dep} ${base_target_name}
COMMENT "Packaging LLVM offloading binary for '${object}'"
Expand All @@ -142,7 +142,7 @@ function(add_gpu_entrypoint_library target_name base_target_name)
COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/stubs/${name}.cpp
DEPENDS ${dep} ${dep}.__gpubin__ ${base_target_name}
)
add_custom_target(${dep}.__stub__
add_custom_target(${dep}.__stub__
DEPENDS ${dep}.__gpubin__ "${CMAKE_CURRENT_BINARY_DIR}/stubs/${name}.cpp")

add_library(${dep}.__fatbin__
Expand All @@ -151,9 +151,9 @@ function(add_gpu_entrypoint_library target_name base_target_name)
)

# This is always compiled for the LLVM host triple instead of the native GPU
# triple that is used by default in the build.
# triple that is used by default in the build.
target_compile_options(${dep}.__fatbin__ BEFORE PRIVATE -nostdlib)
target_compile_options(${dep}.__fatbin__ PRIVATE
target_compile_options(${dep}.__fatbin__ PRIVATE
--target=${LLVM_HOST_TRIPLE}
"SHELL:-Xclang -fembed-offload-object=${CMAKE_CURRENT_BINARY_DIR}/binary/${name}.gpubin")
add_dependencies(${dep}.__fatbin__
Expand Down
2 changes: 1 addition & 1 deletion libc/cmake/modules/LLVMLibCObjectRules.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ function(create_entrypoint_object fq_target_name)

# The NVPTX target cannot use LTO for the internal targets used for testing.
if(LIBC_TARGET_ARCHITECTURE_IS_NVPTX)
target_compile_options(${internal_target_name} PRIVATE
target_compile_options(${internal_target_name} PRIVATE
-fno-lto -march=${LIBC_GPU_TARGET_ARCHITECTURE})
endif()

Expand Down
14 changes: 7 additions & 7 deletions libc/cmake/modules/LLVMLibCTestRules.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -318,8 +318,8 @@ function(add_libc_fuzzer target_name)
target_include_directories(${fq_target_name} SYSTEM PRIVATE ${LIBC_INCLUDE_DIR})
target_include_directories(${fq_target_name} PRIVATE ${LIBC_SOURCE_DIR})

target_link_libraries(${fq_target_name} PRIVATE
${link_object_files}
target_link_libraries(${fq_target_name} PRIVATE
${link_object_files}
${LIBC_FUZZER_LINK_LIBRARIES}
)

Expand Down Expand Up @@ -352,7 +352,7 @@ endif()
# system libc are linked in to the final executable. The final exe is fully
# statically linked. The libc that the final exe links to consists of only
# the object files of the DEPENDS targets.
#
#
# Usage:
# add_integration_test(
# <target name>
Expand Down Expand Up @@ -462,15 +462,15 @@ function(add_integration_test test_name)
target_compile_options(${fq_build_target_name} PRIVATE ${compile_options})

if(LIBC_TARGET_ARCHITECTURE_IS_AMDGPU)
target_link_options(${fq_build_target_name} PRIVATE
target_link_options(${fq_build_target_name} PRIVATE
${LIBC_COMPILE_OPTIONS_DEFAULT}
-mcpu=${LIBC_GPU_TARGET_ARCHITECTURE} -flto
"-Wl,-mllvm,-amdgpu-lower-global-ctor-dtor=0" -nostdlib -static
"-Wl,-mllvm,-amdhsa-code-object-version=${LIBC_GPU_CODE_OBJECT_VERSION}")
elseif(LIBC_TARGET_ARCHITECTURE_IS_NVPTX)
# We need to use the internal object versions for NVPTX.
set(internal_suffix ".__internal__")
target_link_options(${fq_build_target_name} PRIVATE
target_link_options(${fq_build_target_name} PRIVATE
${LIBC_COMPILE_OPTIONS_DEFAULT}
"-Wl,--suppress-stack-size-warning"
-march=${LIBC_GPU_TARGET_ARCHITECTURE} -nostdlib -static
Expand Down Expand Up @@ -645,15 +645,15 @@ function(add_libc_hermetic_test test_name)
endforeach()

if(LIBC_TARGET_ARCHITECTURE_IS_AMDGPU)
target_link_options(${fq_build_target_name} PRIVATE
target_link_options(${fq_build_target_name} PRIVATE
${LIBC_COMPILE_OPTIONS_DEFAULT}
-mcpu=${LIBC_GPU_TARGET_ARCHITECTURE} -flto
"-Wl,-mllvm,-amdgpu-lower-global-ctor-dtor=0" -nostdlib -static
"-Wl,-mllvm,-amdhsa-code-object-version=${LIBC_GPU_CODE_OBJECT_VERSION}")
elseif(LIBC_TARGET_ARCHITECTURE_IS_NVPTX)
# We need to use the internal object versions for NVPTX.
set(internal_suffix ".__internal__")
target_link_options(${fq_build_target_name} PRIVATE
target_link_options(${fq_build_target_name} PRIVATE
${LIBC_COMPILE_OPTIONS_DEFAULT}
"-Wl,--suppress-stack-size-warning"
-march=${LIBC_GPU_TARGET_ARCHITECTURE} -nostdlib -static
Expand Down
2 changes: 1 addition & 1 deletion libc/config/darwin/x86_64/entrypoints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ set(TARGET_LIBC_ENTRYPOINTS
libc.src.ctype.toascii
libc.src.ctype.tolower
libc.src.ctype.toupper

# string.h entrypoints
libc.src.string.bcmp
libc.src.string.bzero
Expand Down
4 changes: 2 additions & 2 deletions libc/config/linux/x86_64/exclude.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ try_compile(
)

if(NOT has_sys_random)
list(APPEND TARGET_LLVMLIBC_REMOVED_ENTRYPOINTS
list(APPEND TARGET_LLVMLIBC_REMOVED_ENTRYPOINTS
libc.src.sys.stat.stat
)
# If we're doing a fullbuild we provide the random header ourselves.
if(NOT LLVM_LIBC_FULL_BUILD)
list(APPEND TARGET_LLVMLIBC_REMOVED_ENTRYPOINTS
list(APPEND TARGET_LLVMLIBC_REMOVED_ENTRYPOINTS
libc.src.sys.random.getrandom
)
endif()
Expand Down
2 changes: 1 addition & 1 deletion libc/config/windows/entrypoints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.acoshf
libc.src.math.asinf
libc.src.math.asinhf
libc.src.math.atanf
libc.src.math.atanf
libc.src.math.atanhf
libc.src.math.copysign
libc.src.math.copysignf
Expand Down
2 changes: 1 addition & 1 deletion libc/docs/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ a list of open projects that one can start with:
#. One is about adding CMake facilities to optionally link the libc's overlay
static archive (see :ref:`overlay_mode`) with other LLVM tools/executables.
#. The other is about putting plumbing in place to release the overlay static
archive (see :ref:`overlay_mode`) as part of the LLVM binary releases.
archive (see :ref:`overlay_mode`) as part of the LLVM binary releases.

#. **Implement Linux syscall wrappers** - A large portion of the POSIX API can
be implemented as syscall wrappers on Linux. A good number have already been
Expand Down
6 changes: 3 additions & 3 deletions libc/docs/date_and_time.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Implementation Status

* To check date and time functions enabled for Windows:

- `windows-x86_64 <https://github.com/llvm/llvm-project/tree/main/libc/config/windows/entrypoints.txt>`_
- `windows-x86_64 <https://github.com/llvm/llvm-project/tree/main/libc/config/windows/entrypoints.txt>`_

- windows-aarch64 - to be added

Expand All @@ -38,11 +38,11 @@ Implementation Status

* To check date and time functions enabled for GPU:

- `gpu-entrypoints <https://github.com/llvm/llvm-project/tree/main/libc/config/gpu/entrypoints.txt>`_
- `gpu-entrypoints <https://github.com/llvm/llvm-project/tree/main/libc/config/gpu/entrypoints.txt>`_

* To check date and time functions enabled for embedded system:

- `barebone-aarch32 <https://github.com/llvm/llvm-project/tree/main/libc/config/baremetal/arm/entrypoints.txt>`_
- `barebone-aarch32 <https://github.com/llvm/llvm-project/tree/main/libc/config/baremetal/arm/entrypoints.txt>`_

- barebone-riscv32 - to be added

Expand Down
2 changes: 1 addition & 1 deletion libc/docs/dev/clang_tidy_checks.rst
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ a public header with non-namespaced functions like ``string.h`` is included.
This check ensures any function call resolves to a function within the
LIBC_NAMESPACE namespace.

There are exceptions for the following functions:
There are exceptions for the following functions:
``__errno_location`` so that ``errno`` can be set;
``malloc``, ``calloc``, ``realloc``, ``aligned_alloc``, and ``free`` since they
are always external and can be intercepted.
Expand Down
2 changes: 1 addition & 1 deletion libc/docs/dev/config_options.rst
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ example, the option-dictionary is:
{
"LIBC_CONF_PRINTF_DISABLE_FLOAT": {
"value": false,
"doc":
"doc":
},
...
}
Expand Down
4 changes: 2 additions & 2 deletions libc/docs/dev/printf_behavior.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Printf Behavior Under All Conditions
====================================

Introduction:
Introduction:
=============
On the "defining undefined behavior" page, I said you should write down your
decisions regarding undefined behavior in your functions. This is that document
Expand Down Expand Up @@ -102,7 +102,7 @@ behavior.
LIBC_COPT_FLOAT_TO_STR_USE_MEGA_LONG_DOUBLE_TABLE
-------------------------------------------------
When set, the float to string decimal conversion algorithm will use a larger
table to accelerate long double conversions. This larger table is around 5MB of
table to accelerate long double conversions. This larger table is around 5MB of
size when compiled.

LIBC_COPT_FLOAT_TO_STR_USE_DYADIC_FLOAT
Expand Down
2 changes: 1 addition & 1 deletion libc/docs/full_cross_build.rst
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ After configuring the build with the above ``cmake`` command, one can build the
the libc for the target with the following command:

.. code-block:: sh

$> ninja libc libm

The above ``ninja`` command will build the libc static archives ``libc.a`` and
Expand Down
30 changes: 15 additions & 15 deletions libc/docs/gpu/motivation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ Motivation and Limitations
Motivation
==========

This project aims to provide a large subset of the C standard library to users
of GPU accelerators. We deliberately choose to only implement a subset of the C
library as some features are not expressly useful or easily implemented on the
GPU. This will be discussed further in `Limitations <libc_gpu_limitations>`_.
The main motivation behind this project is to provide the well understood C
This project aims to provide a large subset of the C standard library to users
of GPU accelerators. We deliberately choose to only implement a subset of the C
library as some features are not expressly useful or easily implemented on the
GPU. This will be discussed further in `Limitations <libc_gpu_limitations>`_.
The main motivation behind this project is to provide the well understood C
library as a firm base for GPU development.

The main idea behind this project is that programming GPUs can be as
The main idea behind this project is that programming GPUs can be as
straightforward as programming on CPUs. This project aims to validate the GPU as
a more general-purpose target. The implementations here will also enable more
complex implementations of other libraries on the GPU, such as ``libc++``.
Expand All @@ -31,10 +31,10 @@ toolchain. We also aim to provide these functions in a format compatible with
offloading in ``Clang`` so that we can treat the C library for the GPU as a
standard static library.

A valuable use for providing C library features on the GPU is for testing. For
this reason we build `tests on the GPU <libc_gpu_testing>`_ that can run a unit
test as if it were being run on the CPU. This also helps users port applications
that traditionally were run on the CPU. With this support, we can expand test
A valuable use for providing C library features on the GPU is for testing. For
this reason we build `tests on the GPU <libc_gpu_testing>`_ that can run a unit
test as if it were being run on the CPU. This also helps users port applications
that traditionally were run on the CPU. With this support, we can expand test
coverage for the GPU backend to the existing LLVM C library tests.

.. _libc_gpu_limitations:
Expand All @@ -43,9 +43,9 @@ Limitations
===========

We only implement a subset of the standard C library. The GPU does not
currently support thread local variables in all cases, so variables like
``errno`` are not provided. Furthermore, the GPU under the OpenCL execution
model cannot safely provide a mutex interface. This means that features like
file buffering are not implemented on the GPU. We can also not easily provide
threading features on the GPU due to the execution model so these will be
currently support thread local variables in all cases, so variables like
``errno`` are not provided. Furthermore, the GPU under the OpenCL execution
model cannot safely provide a mutex interface. This means that features like
file buffering are not implemented on the GPU. We can also not easily provide
threading features on the GPU due to the execution model so these will be
ignored, as will features like ``locale`` or ``time``.
Loading