From d2562915a579bc3a2b06b94df49ed2a7668251d2 Mon Sep 17 00:00:00 2001 From: Jeff Layton Date: Jun 27 2013 12:28:03 +0000 Subject: Add built in byte-swap identifiers. Silences these warnings: include/uapi/linux/swab.h:60:16: error: undefined identifier '__builtin_bswap32' include/uapi/linux/swab.h:60:33: error: not a function Signed-off-by: Jeff Layton --- diff --git a/0001-sparse-add-built-in-byte-swap-identifiers.patch b/0001-sparse-add-built-in-byte-swap-identifiers.patch new file mode 100644 index 0000000..73fa623 --- /dev/null +++ b/0001-sparse-add-built-in-byte-swap-identifiers.patch @@ -0,0 +1,53 @@ +From c38e80269c50494a8357dec19ac8a08dee68d4f2 Mon Sep 17 00:00:00 2001 +From: Kim Phillips +Date: Tue, 19 Feb 2013 11:24:01 -0800 +Subject: [PATCH] sparse: add built-in byte swap identifiers + +this patch stops sparse from complaining about them not being +defined: + +include/uapi/linux/swab.h:60:16: error: undefined identifier '__builtin_bswap32' +include/uapi/linux/swab.h:60:33: error: not a function + +Signed-off-by: Kim Phillips +Signed-off-by: Christopher Li +--- + lib.c | 5 +++++ + validation/builtin_bswap.c | 9 +++++++++ + 2 files changed, 14 insertions(+) + create mode 100644 validation/builtin_bswap.c + +diff --git a/lib.c b/lib.c +index 396e9f1..fa86c2b 100644 +--- a/lib.c ++++ b/lib.c +@@ -698,6 +698,11 @@ void declare_builtin_functions(void) + add_pre_buffer("extern int __builtin_popcountl(unsigned long);\n"); + add_pre_buffer("extern int __builtin_popcountll(unsigned long long);\n"); + ++ /* And byte swaps.. */ ++ add_pre_buffer("extern unsigned short __builtin_bswap16(unsigned short);\n"); ++ add_pre_buffer("extern unsigned int __builtin_bswap32(unsigned int);\n"); ++ add_pre_buffer("extern unsigned long long __builtin_bswap64(unsigned long long);\n"); ++ + /* And some random ones.. */ + add_pre_buffer("extern void *__builtin_return_address(unsigned int);\n"); + add_pre_buffer("extern void *__builtin_extract_return_addr(void *);\n"); +diff --git a/validation/builtin_bswap.c b/validation/builtin_bswap.c +new file mode 100644 +index 0000000..6a4a907 +--- /dev/null ++++ b/validation/builtin_bswap.c +@@ -0,0 +1,9 @@ ++static unsigned short x = __builtin_bswap16(0); ++static unsigned int y = __builtin_bswap32(0); ++static unsigned long long z = __builtin_bswap64(0); ++ ++/* ++ * check-name: __builtin_bswap ++ * check-error-start ++ * check-error-end ++ */ +-- +1.8.1.4 + diff --git a/sparse.spec b/sparse.spec index 015c354..e918a00 100644 --- a/sparse.spec +++ b/sparse.spec @@ -1,6 +1,6 @@ Name: sparse Version: 0.4.4 -Release: 5%{?dist} +Release: 6%{?dist} Summary: A semantic parser of source files Group: Development/Tools License: OSL 1.1 @@ -10,6 +10,8 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: libxml2-devel gtk2-devel +Patch1: 0001-sparse-add-built-in-byte-swap-identifiers.patch + %description Sparse is a semantic parser of source files: it's neither a compiler (although it could be used as a front-end for one) nor is it a @@ -37,6 +39,7 @@ Development headers headers and static lib for sparse-enabled apps %prep %setup -q +%patch1 -p1 %define make_destdir \ make DESTDIR="%{buildroot}" PREFIX="%{_prefix}" \\\ @@ -83,6 +86,9 @@ make clean %changelog +* Thu Jun 27 2013 Jeff Layton - 0.4.4-6 +- add built-in byte swap identifiers + * Fri Feb 15 2013 Fedora Release Engineering - 0.4.4-5 - Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild