Make cpp.py less braindead.
The old code ignored operator precedence (!), despite having two tables of operator precedence. The code's still pretty awful, but I've cleaned it up enough to fix this, the most important bug. This patch lets us correctly clean the uapi unistd.h, stat.h, and swab.h files, and also fixes the mess we were already making of various old kernel header files. I've added a bunch more tests, fixed the existing tests that the existing script was already failing (!), and changed the script so that the tests are run every time the script is run. We can probably remove some of the old kernel header files that we were parsing incorrectly, but we can worry about that later. Bug: 11253477 Change-Id: Ie66c65b3a7ae13b4e98ed8038a6a534f06eae0e5
This commit is contained in:
parent
f1258672d1
commit
40596aa005
|
@ -34,9 +34,6 @@
|
|||
#ifndef _SYS__TYPES_H_
|
||||
#define _SYS__TYPES_H_
|
||||
|
||||
#undef __KERNEL_STRICT_NAMES
|
||||
#define __KERNEL_STRICT_NAMES 1
|
||||
|
||||
#include <machine/_types.h>
|
||||
|
||||
typedef unsigned long __cpuid_t; /* CPU id */
|
||||
|
@ -69,9 +66,4 @@ typedef union {
|
|||
__int64_t __mbstateL; /* for alignment */
|
||||
} __mbstate_t;
|
||||
|
||||
/* BIONIC: if we're using non-cleaned up user-level kernel headers,
|
||||
* this will prevent many type declaration conflicts
|
||||
*/
|
||||
#define __KERNEL_STRICT_NAMES 1
|
||||
|
||||
#endif /* !_SYS__TYPES_H_ */
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
****************************************************************************/
|
||||
#ifndef _ASM_COMPILER_H
|
||||
#define _ASM_COMPILER_H
|
||||
#if __GNUC__ > (3 || __GNUC__ == (3 && __GNUC_MINOR__ >= 4))
|
||||
#if __GNUC__ > 3 || __GNUC__ == 3 && __GNUC_MINOR__ >= 4
|
||||
#define GCC_IMM_ASM() "n"
|
||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
|
||||
#define GCC_REG_ACCUM "$0"
|
||||
|
|
|
@ -18,12 +18,7 @@
|
|||
****************************************************************************/
|
||||
#ifndef _ASM_X86_KMAP_TYPES_H
|
||||
#define _ASM_X86_KMAP_TYPES_H
|
||||
#if defined(CONFIG_X86_32) && defined(CONFIG_DEBUG_HIGHMEM)
|
||||
#define D(n) __KM_FENCE_##n ,
|
||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
|
||||
#else
|
||||
#define D(n)
|
||||
#endif
|
||||
enum km_type {
|
||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
|
||||
D(0) KM_BOUNCE_READ,
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#include <asm/bitsperlong.h>
|
||||
#if __BITS_PER_LONG == 32
|
||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
|
||||
#if defined(__GNUC__) && (!defined(__STRICT_ANSI__) || defined(__KERNEL__))
|
||||
#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
|
||||
#define __SWAB_64_THRU_32__
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -49,7 +49,7 @@ struct backing_dev_info {
|
|||
#define BDI_CAP_WRITE_MAP 0x00000020
|
||||
#define BDI_CAP_EXEC_MAP 0x00000040
|
||||
#define BDI_CAP_VMFLAGS (BDI_CAP_READ_MAP | BDI_CAP_WRITE_MAP | BDI_CAP_EXEC_MAP)
|
||||
#if defined(VM_MAYREAD) && BDI_CAP_READ_MAP != (VM_MAYREAD || BDI_CAP_WRITE_MAP != (VM_MAYWRITE || BDI_CAP_EXEC_MAP != VM_MAYEXEC))
|
||||
#if defined(VM_MAYREAD) && (BDI_CAP_READ_MAP != VM_MAYREAD || BDI_CAP_WRITE_MAP != VM_MAYWRITE || BDI_CAP_EXEC_MAP != VM_MAYEXEC)
|
||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
|
||||
#error please change backing_dev_info::capabilities flags
|
||||
#endif
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#include <linux/timex.h>
|
||||
#include <asm/param.h>
|
||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
|
||||
#if HZ >= (12 && HZ < 24)
|
||||
#if HZ >= 12 && HZ < 24
|
||||
#define SHIFT_HZ 4
|
||||
#elif HZ >= 24 && HZ < 48
|
||||
#define SHIFT_HZ 5
|
||||
|
@ -91,22 +91,22 @@
|
|||
#define MAX_SEC_IN_JIFFIES (SH_DIV((MAX_JIFFY_OFFSET >> SEC_JIFFIE_SC) * TICK_NSEC, NSEC_PER_SEC, 1) - 1)
|
||||
#endif
|
||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
|
||||
#if HZ <= (MSEC_PER_SEC && !(MSEC_PER_SEC % HZ))
|
||||
#if HZ <= MSEC_PER_SEC && !(MSEC_PER_SEC % HZ)
|
||||
#elif HZ > MSEC_PER_SEC && !(HZ % MSEC_PER_SEC)
|
||||
#else
|
||||
#endif
|
||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
|
||||
#if HZ <= (USEC_PER_SEC && !(USEC_PER_SEC % HZ))
|
||||
#if HZ <= USEC_PER_SEC && !(USEC_PER_SEC % HZ)
|
||||
#elif HZ > USEC_PER_SEC && !(HZ % USEC_PER_SEC)
|
||||
#else
|
||||
#endif
|
||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
|
||||
#if HZ <= (MSEC_PER_SEC && !(MSEC_PER_SEC % HZ))
|
||||
#if HZ <= MSEC_PER_SEC && !(MSEC_PER_SEC % HZ)
|
||||
#elif HZ > MSEC_PER_SEC && !(HZ % MSEC_PER_SEC)
|
||||
#else
|
||||
#endif
|
||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
|
||||
#if HZ <= (USEC_PER_SEC && !(USEC_PER_SEC % HZ))
|
||||
#if HZ <= USEC_PER_SEC && !(USEC_PER_SEC % HZ)
|
||||
#elif HZ > USEC_PER_SEC && !(HZ % USEC_PER_SEC)
|
||||
#else
|
||||
#endif
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
|
||||
typedef union {
|
||||
s64 tv64;
|
||||
#if BITS_PER_LONG != (64 && !defined(CONFIG_KTIME_SCALAR))
|
||||
#if BITS_PER_LONG != 64
|
||||
struct {
|
||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
|
||||
#ifdef __BIG_ENDIAN
|
||||
|
|
|
@ -784,7 +784,7 @@ typedef struct mixer_vol_table {
|
|||
#define TMR_SPP 10
|
||||
#define TMR_TIMESIG 11
|
||||
#define LOCL_STARTAUDIO 1
|
||||
#if !defined(__KERNEL__) && !defined(KERNEL) && !defined(INKERNEL) && !defined(_KERNEL) || defined(USE_SEQ_MACROS)
|
||||
#if !defined(KERNEL) && !defined(INKERNEL) && !defined(_KERNEL) || defined(USE_SEQ_MACROS)
|
||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
|
||||
#define SEQ_DECLAREBUF() SEQ_USE_EXTBUF()
|
||||
#define SEQ_PM_DEFINES int __foo_bar___
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -132,7 +132,6 @@ class HeaderScanner:
|
|||
|
||||
list = cpp.BlockParser().parseFile(path)
|
||||
if list:
|
||||
#list.removePrefixed("CONFIG_",self.config)
|
||||
macros = kernel_known_macros.copy()
|
||||
if kernel_root:
|
||||
macros.update(self.config)
|
||||
|
|
|
@ -48,7 +48,7 @@ struct stat {
|
|||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
|
||||
unsigned int __unused5;
|
||||
};
|
||||
#if __BITS_PER_LONG != (64 || defined(__ARCH_WANT_STAT64))
|
||||
#if __BITS_PER_LONG != 64 || defined(__ARCH_WANT_STAT64)
|
||||
struct stat64 {
|
||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
|
||||
unsigned long long st_dev;
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#include <asm/bitsperlong.h>
|
||||
#if __BITS_PER_LONG == 32
|
||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
|
||||
#if defined(__GNUC__) && (!defined(__STRICT_ANSI__) || defined(__KERNEL__))
|
||||
#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
|
||||
#define __SWAB_64_THRU_32__
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#define __SYSCALL(x, y)
|
||||
#endif
|
||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
|
||||
#if __BITS_PER_LONG == (32 || defined(__SYSCALL_COMPAT))
|
||||
#if __BITS_PER_LONG == 32 || defined(__SYSCALL_COMPAT)
|
||||
#define __SC_3264(_nr, _32, _64) __SYSCALL(_nr, _32)
|
||||
#else
|
||||
#define __SC_3264(_nr, _32, _64) __SYSCALL(_nr, _64)
|
||||
|
@ -407,7 +407,7 @@
|
|||
#define __NR_syscalls (__NR_signalfd+1)
|
||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
|
||||
#endif
|
||||
#if __BITS_PER_LONG == (32 || defined(__SYSCALL_COMPAT)) && defined(__ARCH_WANT_SYSCALL_OFF_T)
|
||||
#if (__BITS_PER_LONG == 32 || defined(__SYSCALL_COMPAT)) && defined(__ARCH_WANT_SYSCALL_OFF_T)
|
||||
#define __NR_sendfile 1046
|
||||
#define __NR_ftruncate 1047
|
||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
|
||||
|
@ -473,7 +473,7 @@
|
|||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
|
||||
#define __NR_syscalls (__NR_fork+1)
|
||||
#endif
|
||||
#if __BITS_PER_LONG == (64 && !defined(__SYSCALL_COMPAT))
|
||||
#if __BITS_PER_LONG == 64 && !defined(__SYSCALL_COMPAT)
|
||||
#define __NR_fcntl __NR3264_fcntl
|
||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
|
||||
#define __NR_statfs __NR3264_statfs
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
****************************************************************************/
|
||||
#ifndef _V4L2_DV_TIMINGS_H
|
||||
#define _V4L2_DV_TIMINGS_H
|
||||
#if __GNUC__ < (4 || __GNUC__ == (4 && __GNUC_MINOR__ < 6))
|
||||
#if __GNUC__ < 4 || __GNUC__ == 4 && __GNUC_MINOR__ < 6
|
||||
#define V4L2_INIT_BT_TIMINGS(_width, args...) { .bt = { _width , ## args } }
|
||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
|
||||
#else
|
||||
|
|
Loading…
Reference in New Issue