Roland McGrath 22079e3f36
[libc][hdrgen] Add extra_standards and license_text (#165459)
This adds a few new features to hdrgen, all meant to facilitate
using it with inputs and outputs that are outside the llvm-libc
source tree.

The new `extra_standards` field is a dictionary to augment the
set of names that can be used in `standards` lists.  The keys are
the identifiers used in YAML ("stdc") and the values are the
pretty names generated in the header comments ("Standard C").
This lets a libc project that's leveraging the llvm-libc sources
along with its own code define new APIs outside the formal and de
facto standards that llvm-libc draws its supported APIs from.

The new `license_text` field is a list of lines of license text
that replaces the standard LLVM license text used at the top of
each generated header.  This lets other projects use hdrgen with
their own inputs to produce generated headers that are not tied
to the LLVM project.

Finally, for any function attributes that are not in a canonical
list known to be provided by __llvm-libc-common.h, an include
will be generated for "llvm-libc-macros/{attribute name}.h",
expecting that file to define the "attribute" name as a macro.

All this can be used immediately by builds that drive hdrgen and
build libc code outside the LLVM CMake build.  Future changes
could add CMake plumbing to facilitate augmenting the LLVM CMake
build of libc with outside sources via overlays and cache files.
2025-10-30 10:00:51 -07:00

57 lines
1.4 KiB
C

//===-- C standard library header test_small-------------------------------===//
//
// 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_TEST_SMALL_H
#define LLVM_LIBC_TEST_SMALL_H
#include "__llvm-libc-common.h"
#include "llvm-libc-macros/float16-macros.h"
#include "llvm-libc-macros/CONST_FUNC_A.h"
#include "llvm-libc-macros/test_more-macros.h"
#include "llvm-libc-macros/test_small-macros.h"
#include "llvm-libc-types/float128.h"
#include "llvm-libc-types/type_a.h"
#include "llvm-libc-types/type_b.h"
#define MACRO_A 1
#define MACRO_B 2
#define MACRO_C
enum {
enum_a = value_1,
enum_b = value_2,
};
__BEGIN_C_DECLS
CONST_FUNC_A void func_a(void) __NOEXCEPT;
#ifdef LIBC_TYPES_HAS_FLOAT128
float128 func_b(void) __NOEXCEPT;
#endif // LIBC_TYPES_HAS_FLOAT128
#ifdef LIBC_TYPES_HAS_FLOAT16
_Float16 func_c(int, float) __NOEXCEPT;
_Float16 func_d(int, float) __NOEXCEPT;
#endif // LIBC_TYPES_HAS_FLOAT16
#ifdef LIBC_TYPES_HAS_FLOAT16_AND_FLOAT128
_Float16 func_e(float128) __NOEXCEPT;
#endif // LIBC_TYPES_HAS_FLOAT16_AND_FLOAT128
extern obj object_1;
extern obj object_2;
__END_C_DECLS
#endif // LLVM_LIBC_TEST_SMALL_H