Hello community, here is the log from the commit of package sparse for openSUSE:Factory checked in at 2016-08-05 18:17:50 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/sparse (Old) and /work/SRC/openSUSE:Factory/.sparse.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "sparse" Changes: -------- --- /work/SRC/openSUSE:Factory/sparse/sparse.changes 2016-05-17 17:15:05.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.sparse.new/sparse.changes 2016-08-05 18:17:55.000000000 +0200 @@ -1,0 +2,17 @@ +Thu Aug 04 13:37:04 UTC 2016 - [email protected] + +- Switch to the chrisl's repo +- Update to version 0.5+git.20160223: + * Ignore pure attribute in assignement + * Add tests for the builtin INF and nan() functions. + * sparse/parse.c: ignore hotpatch attribute + * sparse, llvm: compile: skip function prototypes to avoid SIGSEGV + * validation/prototype: regression for skipping prototypes + * ptrlist: reading deleted items in NEXT_PTR_LIST() + * .gitignore: add cscope and Qt project files + * Add default case to switches on enum variables + * Fix size calculation of unsized bool array + * Do not drop 'nocast' modifier when taking the address. +- add parse-add-support-for-no_sanitize_-attributes.patch + +------------------------------------------------------------------- Old: ---- sparse-0.5+git.20150208.tar.xz New: ---- parse-add-support-for-no_sanitize_-attributes.patch sparse-0.5+git.20160223.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ sparse.spec ++++++ --- /var/tmp/diff_new_pack.GBi65m/_old 2016-08-05 18:17:56.000000000 +0200 +++ /var/tmp/diff_new_pack.GBi65m/_new 2016-08-05 18:17:56.000000000 +0200 @@ -17,13 +17,14 @@ Name: sparse -Version: 0.5+git.20150208 +Version: 0.5+git.20160223 Release: 0 Summary: A semantic parser of source files License: MIT Group: Development/Tools/Building Url: https://sparse.wiki.kernel.org/index.php/Main_Page Source: sparse-%{version}.tar.xz +Patch0: parse-add-support-for-no_sanitize_-attributes.patch BuildRequires: gcc BuildRequires: gcc-c++ BuildRequires: make @@ -79,6 +80,7 @@ %prep %setup -q +%patch0 -p1 %build make \ ++++++ _service ++++++ --- /var/tmp/diff_new_pack.GBi65m/_old 2016-08-05 18:17:56.000000000 +0200 +++ /var/tmp/diff_new_pack.GBi65m/_new 2016-08-05 18:17:56.000000000 +0200 @@ -1,6 +1,6 @@ <services> <service mode="localonly" name="tar_scm"> - <param name="url">git://git.kernel.org/pub/scm/devel/sparse/sparse.git</param> + <param name="url">git://git.kernel.org/pub/scm/devel/sparse/chrisl/sparse.git</param> <param name="scm">git</param> <param name="changesgenerate">enable</param> <param name="filename">sparse</param> ++++++ parse-add-support-for-no_sanitize_-attributes.patch ++++++ From: Jiri Slaby <[email protected]> Date: Thu, 4 Aug 2016 15:24:11 +0200 Subject: parse: add support for no_sanitize_* attributes Patch-mainline: no, submitted gcc added support for new no_sanitize_* function attributes: * no_address_safety_analysis * no_sanitize_address * no_sanitize_thread * no_sanitize_undefined The kernel uses at least no_sanitize_address as of now. So add them (and their __...__ counterparts) to ignored_attributes as we can safely ignore them. Signed-off-by: Jiri Slaby <[email protected]> --- parse.c | 8 ++++++++ validation/attr-no_sanitize.c | 15 +++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 validation/attr-no_sanitize.c diff --git a/parse.c b/parse.c index b43d6835528b..c1ce70b2a4e5 100644 --- a/parse.c +++ b/parse.c @@ -562,6 +562,14 @@ const char *ignored_attributes[] = { "__naked__", "no_instrument_function", "__no_instrument_function__", + "no_address_safety_analysis", + "__no_address_safety_analysis__", + "no_sanitize_address", + "__no_sanitize_address__", + "no_sanitize_thread", + "__no_sanitize_thread__", + "no_sanitize_undefined", + "__no_sanitize_undefined__", "noclone", "__noclone", "__noclone__", diff --git a/validation/attr-no_sanitize.c b/validation/attr-no_sanitize.c new file mode 100644 index 000000000000..c776027ff202 --- /dev/null +++ b/validation/attr-no_sanitize.c @@ -0,0 +1,15 @@ +static void __attribute__((no_sanitize_address)) foo(void) +{ +} + +static void __attribute__((no_sanitize_thread)) bar(void) +{ +} + +static void __attribute__((no_sanitize_undefined)) baz(void) +{ +} + +/* + * check-name: attribute no_sanitize_address + */ -- 2.9.2 ++++++ sparse-0.5+git.20150208.tar.xz -> sparse-0.5+git.20160223.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sparse-0.5+git.20150208/c2xml.c new/sparse-0.5+git.20160223/c2xml.c --- old/sparse-0.5+git.20150208/c2xml.c 2016-05-08 12:52:56.000000000 +0200 +++ new/sparse-0.5+git.20160223/c2xml.c 2016-08-04 15:37:01.000000000 +0200 @@ -214,6 +214,8 @@ case SYM_UNINITIALIZED: newProp(child, "base-type-builtin", builtin_typename(sym)); break; + default: + break; } return; } @@ -330,4 +332,3 @@ return 0; } - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sparse-0.5+git.20150208/evaluate.c new/sparse-0.5+git.20160223/evaluate.c --- old/sparse-0.5+git.20150208/evaluate.c 2016-05-08 12:52:56.000000000 +0200 +++ new/sparse-0.5+git.20160223/evaluate.c 2016-08-04 15:37:01.000000000 +0200 @@ -623,7 +623,7 @@ static void examine_fn_arguments(struct symbol *fn); -#define MOD_IGN (MOD_VOLATILE | MOD_CONST) +#define MOD_IGN (MOD_VOLATILE | MOD_CONST | MOD_PURE) const char *type_difference(struct ctype *c1, struct ctype *c2, unsigned long mod1, unsigned long mod2) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sparse-0.5+git.20150208/lib.c new/sparse-0.5+git.20160223/lib.c --- old/sparse-0.5+git.20150208/lib.c 2016-05-08 12:52:56.000000000 +0200 +++ new/sparse-0.5+git.20160223/lib.c 2016-08-04 15:37:01.000000000 +0200 @@ -876,6 +876,17 @@ add_pre_buffer("extern int __builtin_islessgreater(float, float);\n"); add_pre_buffer("extern int __builtin_isunordered(float, float);\n"); + /* And some INFINITY / NAN stuff.. */ + add_pre_buffer("extern double __builtin_huge_val(void);\n"); + add_pre_buffer("extern float __builtin_huge_valf(void);\n"); + add_pre_buffer("extern long double __builtin_huge_vall(void);\n"); + add_pre_buffer("extern double __builtin_inf(void);\n"); + add_pre_buffer("extern float __builtin_inff(void);\n"); + add_pre_buffer("extern long double __builtin_infl(void);\n"); + add_pre_buffer("extern double __builtin_nan(const char *);\n"); + add_pre_buffer("extern float __builtin_nanf(const char *);\n"); + add_pre_buffer("extern long double __builtin_nanl(const char *);\n"); + /* And some __FORTIFY_SOURCE ones.. */ add_pre_buffer ("extern __SIZE_TYPE__ __builtin_object_size(void *, int);\n"); add_pre_buffer ("extern void * __builtin___memcpy_chk(void *, const void *, __SIZE_TYPE__, __SIZE_TYPE__);\n"); @@ -959,6 +970,7 @@ add_pre_buffer("#define __builtin_va_alist (*(void *)0)\n"); add_pre_buffer("#define __builtin_va_arg_incr(x) ((x) + 1)\n"); add_pre_buffer("#define __builtin_va_copy(dest, src) ({ dest = src; (void)0; })\n"); + add_pre_buffer("#define __builtin_ms_va_copy(dest, src) ({ dest = src; (void)0; })\n"); add_pre_buffer("#define __builtin_va_end(arg)\n"); add_pre_buffer("#define __builtin_ms_va_end(arg)\n"); add_pre_buffer("#define __builtin_va_arg_pack()\n"); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sparse-0.5+git.20150208/parse.c new/sparse-0.5+git.20160223/parse.c --- old/sparse-0.5+git.20150208/parse.c 2016-05-08 12:52:56.000000000 +0200 +++ new/sparse-0.5+git.20160223/parse.c 2016-08-04 15:37:01.000000000 +0200 @@ -540,6 +540,8 @@ "__gnu_inline__", "hot", "__hot__", + "hotpatch", + "__hotpatch__", "leaf", "__leaf__", "l1_text", @@ -2769,6 +2771,9 @@ case SYM_ENUM: case SYM_RESTRICT: base_type->ident = ident; + break; + default: + break; } } } else if (base_type && base_type->type == SYM_FN) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sparse-0.5+git.20150208/ptrlist.h new/sparse-0.5+git.20160223/ptrlist.h --- old/sparse-0.5+git.20150208/ptrlist.h 2016-05-08 12:52:56.000000000 +0200 +++ new/sparse-0.5+git.20160223/ptrlist.h 2016-08-04 15:37:01.000000000 +0200 @@ -97,6 +97,8 @@ } else { \ __list = __list->next; \ ptr = NULL; \ + while (__list->nr == 0 && __list != __head) \ + __list = __list->next; \ if (__list != __head) { \ __nr = 0; \ ptr = PTR_ENTRY(__list,0); \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sparse-0.5+git.20150208/sparse-llvm.c new/sparse-0.5+git.20160223/sparse-llvm.c --- old/sparse-0.5+git.20150208/sparse-llvm.c 2016-05-08 12:52:56.000000000 +0200 +++ new/sparse-0.5+git.20160223/sparse-llvm.c 2016-08-04 15:37:01.000000000 +0200 @@ -1070,6 +1070,13 @@ return data; } +static int is_prototype(struct symbol *sym) +{ + if (sym->type == SYM_NODE) + sym = sym->ctype.base_type; + return sym && sym->type == SYM_FN && !sym->stmt; +} + static int compile(LLVMModuleRef module, struct symbol_list *list) { struct symbol *sym; @@ -1077,6 +1084,10 @@ FOR_EACH_PTR(list, sym) { struct entrypoint *ep; expand_symbol(sym); + + if (is_prototype(sym)) + continue; + ep = linearize_symbol(sym); if (ep) output_fn(module, ep); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sparse-0.5+git.20150208/symbol.c new/sparse-0.5+git.20160223/symbol.c --- old/sparse-0.5+git.20150208/symbol.c 2016-05-08 12:52:56.000000000 +0200 +++ new/sparse-0.5+git.20160223/symbol.c 2016-08-04 15:37:01.000000000 +0200 @@ -393,7 +393,7 @@ int count = count_array_initializer(node_type, initializer); if (node_type && node_type->bit_size >= 0) - bit_size = node_type->bit_size * count; + bit_size = array_element_offset(node_type->bit_size, count); } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sparse-0.5+git.20150208/symbol.h new/sparse-0.5+git.20160223/symbol.h --- old/sparse-0.5+git.20150208/symbol.h 2016-05-08 12:52:56.000000000 +0200 +++ new/sparse-0.5+git.20160223/symbol.h 2016-08-04 15:37:01.000000000 +0200 @@ -247,7 +247,7 @@ #define MOD_SIZE (MOD_CHAR | MOD_SHORT | MOD_LONG_ALL) #define MOD_IGNORE (MOD_TOPLEVEL | MOD_STORAGE | MOD_ADDRESSABLE | \ MOD_ASSIGNED | MOD_USERTYPE | MOD_ACCESSED | MOD_EXPLICITLY_SIGNED) -#define MOD_PTRINHERIT (MOD_VOLATILE | MOD_CONST | MOD_NODEREF | MOD_STORAGE | MOD_NORETURN) +#define MOD_PTRINHERIT (MOD_VOLATILE | MOD_CONST | MOD_NODEREF | MOD_STORAGE | MOD_NORETURN | MOD_NOCAST) /* Current parsing/evaluation function */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sparse-0.5+git.20150208/validation/bool-array.c new/sparse-0.5+git.20160223/validation/bool-array.c --- old/sparse-0.5+git.20150208/validation/bool-array.c 1970-01-01 01:00:00.000000000 +0100 +++ new/sparse-0.5+git.20160223/validation/bool-array.c 2016-08-04 15:37:02.000000000 +0200 @@ -0,0 +1,47 @@ +static _Bool boolarray_d1[1]; +static _Bool boolarray_d8[8]; +static _Bool boolarray_i2[2] = { + 0, + 1, +}; +static int nd1 = sizeof(boolarray_d1); +static int nd8 = sizeof(boolarray_d8); +static int ni2 = sizeof(boolarray_i2); + + +static long longarray_u2[] = { + 0, + 1, +}; +static int nl2 = sizeof(longarray_u2); + +/* + * Used to get "warning: excessive elements in array initializer" + * for all elements but the first one. + * Note: only occurs if nbr of elements is a multiple of 8 + * (if not, theer was another problem) + */ +static _Bool boolarray_u8[] = { + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, +}; + +/* + * Used to get "error: cannot size expression" for the sizeof. + */ +static _Bool boolarray_u2[] = { + 0, + 1, +}; +static int nu2 = sizeof(boolarray_u2); + +/* + * check-name: sizeof(bool array) + * check-command: sparse -Wno-sizeof-bool $file + */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sparse-0.5+git.20150208/validation/builtin_inf.c new/sparse-0.5+git.20160223/validation/builtin_inf.c --- old/sparse-0.5+git.20150208/validation/builtin_inf.c 1970-01-01 01:00:00.000000000 +0100 +++ new/sparse-0.5+git.20160223/validation/builtin_inf.c 2016-08-04 15:37:02.000000000 +0200 @@ -0,0 +1,13 @@ +static double d = __builtin_huge_val(); +static float f = __builtin_huge_valf(); +static long double l = __builtin_huge_vall(); +static double di = __builtin_inf(); +static float fi = __builtin_inff(); +static long double li = __builtin_infl(); +static double dn = __builtin_nan(""); +static float fn = __builtin_nanf(""); +static long double ln = __builtin_nanl(""); + +/* + * check-name: __builtin INFINITY / nan() + */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sparse-0.5+git.20150208/validation/nocast.c new/sparse-0.5+git.20160223/validation/nocast.c --- old/sparse-0.5+git.20150208/validation/nocast.c 1970-01-01 01:00:00.000000000 +0100 +++ new/sparse-0.5+git.20160223/validation/nocast.c 2016-08-04 15:37:02.000000000 +0200 @@ -0,0 +1,197 @@ +#define __nocast __attribute__((nocast)) +typedef unsigned long __nocast ulong_nc_t; + +extern void use_val(ulong_nc_t); +extern void use_ptr(ulong_nc_t *); + +/* use address */ +static void good_use_address(void) +{ + ulong_nc_t t; + + use_ptr(&t); +} + +static ulong_nc_t *good_ret_address(void) +{ + static ulong_nc_t t; + + return &t; +} + +static ulong_nc_t good_deref(ulong_nc_t *t) +{ + return *t; +} + +/* assign value */ +static ulong_nc_t t; +static ulong_nc_t good_assign_self = t; +static unsigned long good_assign_sametype = t; + +/* assign pointer */ +static ulong_nc_t *good_ptr = &t; +static ulong_nc_t *bad_ptr_to = 1UL; +static unsigned long *bad_ptr_from = &t; + +/* arithmetic operation */ +static ulong_nc_t good_arith(ulong_nc_t t, unsigned int n) +{ + return t + n; +} + +/* implicit cast to other types */ +static unsigned long good_ret_samecast(ulong_nc_t t) +{ + return t; +} +static unsigned long long bad_ret_biggercast(ulong_nc_t t) +{ + return t; +} +static long bad_ret_signcast(ulong_nc_t t) +{ + return t; +} +static short bad_ret_smallercast(ulong_nc_t t) +{ + return t; +} + +static void assign_val(ulong_nc_t t) +{ + ulong_nc_t good_c = t; + unsigned long good_ul = t; + unsigned long long bad_ull = t; + long bad_l = t; + short bad_i = t; +} + +static void assign_via_ptr(ulong_nc_t *t) +{ + ulong_nc_t good_c = *t; + unsigned long good_ul = *t; + unsigned long long bad_ull = *t; + long bad_l = *t; + short bad_i = *t; +} + +static void assign_ptr(ulong_nc_t *t) +{ + ulong_nc_t *good_same_type = t; + unsigned long *bad_mod = t; + unsigned long long __nocast *bad_size = t; + short __nocast *bad_i = t; + long __nocast *bad_l = t; +} + +/* implicit cast to nocast */ +static void implicit_assign_to(void) +{ + ulong_nc_t t; + unsigned long ul = 1; + unsigned short us = 1; + unsigned long long ull = 1; + long l = 1; + + t = ul; /* implicit to nocast from same type: OK? */ + t = us; + t = ull; + t = l; +} + +static void bad_implicit_arg_to(void) +{ + unsigned long ul = 1; + unsigned short us = 1; + unsigned long long ull = 1; + long l = 1; + + use_val(ul); /* implicit to nocast from same type: OK? */ + use_val(us); + use_val(ull); + use_val(l); +} + +/* implicit cast from nocast */ +static unsigned long good_implicit_ret_ul(ulong_nc_t t) +{ + return t; /* implicit to nocast from same type: OK? */ +} + +static unsigned short bad_implicit_ret_us(ulong_nc_t t) +{ + return t; +} + +static unsigned long long bad_implicit_ret_ull(ulong_nc_t t) +{ + return t; +} + +static long bad_implicit_ret_l(ulong_nc_t t) +{ + return t; +} + +/* FIXME: explicit cast: should we complain? */ +static ulong_nc_t good_samecast(ulong_nc_t v) +{ + return (ulong_nc_t) v; +} + +static ulong_nc_t bad_tocast(unsigned long v) +{ + return (ulong_nc_t) v; +} + +static unsigned long bad_fromcast(ulong_nc_t v) +{ + return (unsigned long) v; +} + +/* + * check-name: nocast.c + * + * check-error-start +nocast.c:34:33: warning: incorrect type in initializer (different base types) +nocast.c:34:33: expected unsigned long [nocast] [usertype] *static [toplevel] bad_ptr_to +nocast.c:34:33: got unsigned long +nocast.c:34:33: warning: implicit cast to nocast type +nocast.c:35:39: warning: incorrect type in initializer (different modifiers) +nocast.c:35:39: expected unsigned long *static [toplevel] bad_ptr_from +nocast.c:35:39: got unsigned long static [nocast] [toplevel] *<noident> +nocast.c:35:39: warning: implicit cast from nocast type +nocast.c:50:16: warning: implicit cast from nocast type +nocast.c:54:16: warning: implicit cast from nocast type +nocast.c:58:16: warning: implicit cast from nocast type +nocast.c:65:38: warning: implicit cast from nocast type +nocast.c:66:22: warning: implicit cast from nocast type +nocast.c:67:23: warning: implicit cast from nocast type +nocast.c:74:38: warning: implicit cast from nocast type +nocast.c:75:22: warning: implicit cast from nocast type +nocast.c:76:23: warning: implicit cast from nocast type +nocast.c:82:34: warning: incorrect type in initializer (different modifiers) +nocast.c:82:34: expected unsigned long *bad_mod +nocast.c:82:34: got unsigned long [nocast] [usertype] *t +nocast.c:82:34: warning: implicit cast from nocast type +nocast.c:83:49: warning: incorrect type in initializer (different type sizes) +nocast.c:83:49: expected unsigned long long [nocast] *bad_size +nocast.c:83:49: got unsigned long [nocast] [usertype] *t +nocast.c:83:49: warning: implicit cast to/from nocast type +nocast.c:84:33: warning: incorrect type in initializer (different type sizes) +nocast.c:84:33: expected short [nocast] *bad_i +nocast.c:84:33: got unsigned long [nocast] [usertype] *t +nocast.c:84:33: warning: implicit cast to/from nocast type +nocast.c:85:32: warning: implicit cast to/from nocast type +nocast.c:98:13: warning: implicit cast to nocast type +nocast.c:99:13: warning: implicit cast to nocast type +nocast.c:100:13: warning: implicit cast to nocast type +nocast.c:111:17: warning: implicit cast to nocast type +nocast.c:112:17: warning: implicit cast to nocast type +nocast.c:113:17: warning: implicit cast to nocast type +nocast.c:124:16: warning: implicit cast from nocast type +nocast.c:129:16: warning: implicit cast from nocast type +nocast.c:134:16: warning: implicit cast from nocast type + * check-error-end + */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sparse-0.5+git.20150208/validation/prototype.c new/sparse-0.5+git.20160223/validation/prototype.c --- old/sparse-0.5+git.20150208/validation/prototype.c 1970-01-01 01:00:00.000000000 +0100 +++ new/sparse-0.5+git.20160223/validation/prototype.c 2016-08-04 15:37:02.000000000 +0200 @@ -0,0 +1,6 @@ +static int prototype(void); + +/* + * check-name: Compile skip function prototype + * check-command: ./sparsec -c $file -o tmp.o + */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sparse-0.5+git.20150208/validation/pure-function.c new/sparse-0.5+git.20160223/validation/pure-function.c --- old/sparse-0.5+git.20150208/validation/pure-function.c 1970-01-01 01:00:00.000000000 +0100 +++ new/sparse-0.5+git.20160223/validation/pure-function.c 2016-08-04 15:37:02.000000000 +0200 @@ -0,0 +1,16 @@ + +static __attribute__((__pure__)) int pure1(void) +{ + int i = 0; + return i; +} + +static __attribute__((__pure__)) void *pure2(void) +{ + void *i = (void *)0; + return i; +} + +/* + * check-name: Pure function attribute + */
