isystem: ship and use stdarg.h

Ship minimal stdarg.h (1 type, 4 macros) as <linux/stdarg.h>.
stdarg.h is the only userspace header commonly used in the kernel.

GPL 2 version of <stdarg.h> can be extracted from
http://archive.debian.org/debian/pool/main/g/gcc-4.2/gcc-4.2_4.2.4.orig.tar.gz

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
This commit is contained in:
Alexey Dobriyan 2021-08-02 23:40:32 +03:00 committed by Masahiro Yamada
parent 39f75da7bc
commit c0891ac15f
31 changed files with 41 additions and 31 deletions

View File

@ -51,7 +51,7 @@
* prumpf 991016 * prumpf 991016
*/ */
#include <stdarg.h> #include <linux/stdarg.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/init.h> #include <linux/init.h>

View File

@ -14,7 +14,7 @@
/* we cannot use FORTIFY as it brings in new symbols */ /* we cannot use FORTIFY as it brings in new symbols */
#define __NO_FORTIFY #define __NO_FORTIFY
#include <stdarg.h> #include <linux/stdarg.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/string.h> #include <linux/string.h>
#include <linux/init.h> #include <linux/init.h>

View File

@ -7,7 +7,7 @@
* Copyright (C) 2001 IBM. * Copyright (C) 2001 IBM.
*/ */
#include <stdarg.h> #include <linux/stdarg.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>

View File

@ -5,7 +5,7 @@
* c 2001 PPC 64 Team, IBM Corp * c 2001 PPC 64 Team, IBM Corp
*/ */
#include <stdarg.h> #include <linux/stdarg.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/console.h> #include <linux/console.h>

View File

@ -1,5 +1,6 @@
// SPDX-License-Identifier: GPL-2.0 // SPDX-License-Identifier: GPL-2.0
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/stdarg.h>
#include <linux/string.h> #include <linux/string.h>
#include <linux/ctype.h> #include <linux/ctype.h>
#include <asm/stacktrace.h> #include <asm/stacktrace.h>
@ -8,7 +9,6 @@
#include <asm/setup.h> #include <asm/setup.h>
#include <asm/sclp.h> #include <asm/sclp.h>
#include <asm/uv.h> #include <asm/uv.h>
#include <stdarg.h>
#include "boot.h" #include "boot.h"
const char hex_asc[] = "0123456789abcdef"; const char hex_asc[] = "0123456789abcdef";

View File

@ -18,7 +18,7 @@
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
#include <stdarg.h> #include <linux/stdarg.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/edd.h> #include <linux/edd.h>
#include <asm/setup.h> #include <asm/setup.h>

View File

@ -7,7 +7,7 @@
* Copyright 2011 Intel Corporation; author Matt Fleming * Copyright 2011 Intel Corporation; author Matt Fleming
*/ */
#include <stdarg.h> #include <linux/stdarg.h>
#include <linux/ctype.h> #include <linux/ctype.h>
#include <linux/efi.h> #include <linux/efi.h>

View File

@ -10,7 +10,7 @@
* Oh, it's a waste of space, but oh-so-yummy for debugging. * Oh, it's a waste of space, but oh-so-yummy for debugging.
*/ */
#include <stdarg.h> #include <linux/stdarg.h>
#include <linux/compiler.h> #include <linux/compiler.h>
#include <linux/ctype.h> #include <linux/ctype.h>

View File

@ -28,9 +28,9 @@
*/ */
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/stdarg.h>
#include "dm_services.h" #include "dm_services.h"
#include <stdarg.h>
#include "dc.h" #include "dc.h"
#include "dc_dmub_srv.h" #include "dc_dmub_srv.h"

View File

@ -25,7 +25,7 @@
#define DEBUG /* for pr_debug() */ #define DEBUG /* for pr_debug() */
#include <stdarg.h> #include <linux/stdarg.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/moduleparam.h> #include <linux/moduleparam.h>

View File

@ -379,7 +379,7 @@ static char *pnames[] =
/*2f */ "Useruserdata" /*2f */ "Useruserdata"
}; };
#include <stdarg.h> #include <linux/stdarg.h>
/*-------------------------------------------------------*/ /*-------------------------------------------------------*/
static _cdebbuf *bufprint(_cdebbuf *cdb, char *fmt, ...) static _cdebbuf *bufprint(_cdebbuf *cdb, char *fmt, ...)

View File

@ -9,7 +9,7 @@
* *
* Copyright (C) 1996 Paul Mackerras. * Copyright (C) 1996 Paul Mackerras.
*/ */
#include <stdarg.h> #include <linux/stdarg.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/kernel.h> #include <linux/kernel.h>

View File

@ -18,7 +18,7 @@
* a sleep or a freq. switch * a sleep or a freq. switch
* *
*/ */
#include <stdarg.h> #include <linux/stdarg.h>
#include <linux/mutex.h> #include <linux/mutex.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/errno.h> #include <linux/errno.h>

View File

@ -16,7 +16,7 @@
#ifndef __PRINT_SUPPORT_H_INCLUDED__ #ifndef __PRINT_SUPPORT_H_INCLUDED__
#define __PRINT_SUPPORT_H_INCLUDED__ #define __PRINT_SUPPORT_H_INCLUDED__
#include <stdarg.h> #include <linux/stdarg.h>
extern int (*sh_css_printf)(const char *fmt, va_list args); extern int (*sh_css_printf)(const char *fmt, va_list args);
/* depends on host supplied print function in ia_css_init() */ /* depends on host supplied print function in ia_css_init() */

View File

@ -17,7 +17,7 @@
#define __IA_CSS_ENV_H #define __IA_CSS_ENV_H
#include <type_support.h> #include <type_support.h>
#include <stdarg.h> /* va_list */ #include <linux/stdarg.h> /* va_list */
#include "ia_css_types.h" #include "ia_css_types.h"
#include "ia_css_acc_types.h" #include "ia_css_acc_types.h"

View File

@ -19,7 +19,7 @@
/*! \file */ /*! \file */
#include <type_support.h> #include <type_support.h>
#include <stdarg.h> #include <linux/stdarg.h>
#include "ia_css_types.h" #include "ia_css_types.h"
#include "ia_css_binary.h" #include "ia_css_binary.h"
#include "ia_css_frame_public.h" #include "ia_css_frame_public.h"

View File

@ -20,7 +20,7 @@
#include <math_support.h> #include <math_support.h>
#include <type_support.h> #include <type_support.h>
#include <platform_support.h> #include <platform_support.h>
#include <stdarg.h> #include <linux/stdarg.h>
#if !defined(ISP2401) #if !defined(ISP2401)
#include "input_formatter.h" #include "input_formatter.h"

View File

@ -14,7 +14,7 @@
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#ifdef __KERNEL__ #ifdef __KERNEL__
#include <stdarg.h> #include <linux/stdarg.h>
#include <linux/string.h> #include <linux/string.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/kernel.h> #include <linux/kernel.h>

View File

@ -8,7 +8,7 @@
#include <linux/string.h> #include <linux/string.h>
#include <linux/buffer_head.h> #include <linux/buffer_head.h>
#include <stdarg.h> #include <linux/stdarg.h>
static char error_buf[1024]; static char error_buf[1024];
static char fmt_buf[1024]; static char fmt_buf[1024];

View File

@ -70,7 +70,7 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/bitops.h> #include <linux/bitops.h>
#include <stdarg.h> #include <linux/stdarg.h>
#include <linux/uaccess.h> #include <linux/uaccess.h>

View File

@ -22,7 +22,7 @@ typedef __builtin_va_list va_list;
#define va_arg(v, l) __builtin_va_arg(v, l) #define va_arg(v, l) __builtin_va_arg(v, l)
#define va_copy(d, s) __builtin_va_copy(d, s) #define va_copy(d, s) __builtin_va_copy(d, s)
#else #else
#include <stdarg.h> #include <linux/stdarg.h>
#endif #endif
#endif #endif

View File

@ -2,7 +2,7 @@
#ifndef _LINUX_KERNEL_H #ifndef _LINUX_KERNEL_H
#define _LINUX_KERNEL_H #define _LINUX_KERNEL_H
#include <stdarg.h> #include <linux/stdarg.h>
#include <linux/align.h> #include <linux/align.h>
#include <linux/limits.h> #include <linux/limits.h>
#include <linux/linkage.h> #include <linux/linkage.h>

View File

@ -2,7 +2,7 @@
#ifndef __KERNEL_PRINTK__ #ifndef __KERNEL_PRINTK__
#define __KERNEL_PRINTK__ #define __KERNEL_PRINTK__
#include <stdarg.h> #include <linux/stdarg.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/kern_levels.h> #include <linux/kern_levels.h>
#include <linux/linkage.h> #include <linux/linkage.h>

11
include/linux/stdarg.h Normal file
View File

@ -0,0 +1,11 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#ifndef _LINUX_STDARG_H
#define _LINUX_STDARG_H
typedef __builtin_va_list va_list;
#define va_start(v, l) __builtin_va_start(v, l)
#define va_end(v) __builtin_va_end(v)
#define va_arg(v, T) __builtin_va_arg(v, T)
#define va_copy(d, s) __builtin_va_copy(d, s)
#endif

View File

@ -6,7 +6,7 @@
#include <linux/types.h> /* for size_t */ #include <linux/types.h> /* for size_t */
#include <linux/stddef.h> /* for NULL */ #include <linux/stddef.h> /* for NULL */
#include <linux/errno.h> /* for E2BIG */ #include <linux/errno.h> /* for E2BIG */
#include <stdarg.h> #include <linux/stdarg.h>
#include <uapi/linux/string.h> #include <uapi/linux/string.h>
extern char *strndup_user(const char __user *, long); extern char *strndup_user(const char __user *, long);

View File

@ -5,8 +5,6 @@
* CONFIG_DEBUG_INFO_REDUCED. Please do not add actual code. However, * CONFIG_DEBUG_INFO_REDUCED. Please do not add actual code. However,
* adding appropriate #includes is fine. * adding appropriate #includes is fine.
*/ */
#include <stdarg.h>
#include <linux/cred.h> #include <linux/cred.h>
#include <linux/crypto.h> #include <linux/crypto.h>
#include <linux/dcache.h> #include <linux/dcache.h>
@ -22,6 +20,7 @@
#include <linux/net.h> #include <linux/net.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/stdarg.h>
#include <linux/types.h> #include <linux/types.h>
#include <net/addrconf.h> #include <net/addrconf.h>
#include <net/sock.h> #include <net/sock.h>

View File

@ -5,7 +5,7 @@
* Copyright (C) 1991, 1992 Linus Torvalds * Copyright (C) 1991, 1992 Linus Torvalds
*/ */
#include <stdarg.h> #include <linux/stdarg.h>
#include <linux/export.h> #include <linux/export.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/types.h> #include <linux/types.h>

View File

@ -11,7 +11,7 @@
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/types.h> #include <linux/types.h>
#include <stdarg.h> #include <linux/stdarg.h>
struct string_stream_fragment { struct string_stream_fragment {
struct kunit *test; struct kunit *test;

View File

@ -17,7 +17,7 @@
* - scnprintf and vscnprintf * - scnprintf and vscnprintf
*/ */
#include <stdarg.h> #include <linux/stdarg.h>
#include <linux/build_bug.h> #include <linux/build_bug.h>
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/clk-provider.h> #include <linux/clk-provider.h>

View File

@ -5,7 +5,7 @@
* Copyright (C) 2020, Google LLC. * Copyright (C) 2020, Google LLC.
*/ */
#include <stdarg.h> #include <linux/stdarg.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/lockdep.h> #include <linux/lockdep.h>

View File

@ -7,7 +7,7 @@
#include "log.h" #include "log.h"
#include "main.h" #include "main.h"
#include <stdarg.h> #include <linux/stdarg.h>
#include "trace.h" #include "trace.h"