Commit 745224e0 ("refs.c: SSE2 optimizations for check_refname_\ component", 18-06-2014) introduces (on x86_64) the use of sse2 code, and associated header files, to optimize some reference handling code. This causes sparse to implode and exit with "too many errors", among other things, while attempting to parse the code contained in those headers. For example, the following shows just the last few messages: $ make abspath.sp ... /usr/lib/gcc/x86_64-pc-cygwin/4.8.3//include/mmintrin.h:724:38: error: attribute '__gnu_inline__': unknown attribute /usr/lib/gcc/x86_64-pc-cygwin/4.8.3//include/mmintrin.h:732:38: error: too many errors /usr/lib/gcc/x86_64-pc-cygwin/4.8.3//include/xmmintrin.h:91:34: error: constant 0.0f is not a valid number Makefile:2297: recipe for target 'abspath.sp' failed make: *** [abspath.sp] Error 1 $ The most numerous errors (about 100 for the above file) relate to the use of the __gnu_inline__ attribute. A simple 'one line' patch to sparse (actually it is three lines), can fix this up without too much problem. However, the final error above is not as simple (and quick) to fix. The code in question (.../xmmintrin.h:91), looks like this: return __extension__ (__m128){ 0.0f, 0.0f, 0.0f, 0.0f }; Until sparse learns to parse this gcc extension (if ever), we can avoid the issue by simply not attempting to parse this code. In order to do this, use the preprocessor symbol __CHECKER__, automatically defined by sparse, in the #if conditional already used to guard the code. Signed-off-by: Ramsay Jones <ramsay@xxxxxxxxxxxxxxxxxxx> --- Hi Junio, I've been sitting on this patch for some time, while I try to gauge how long it would take to fix sparse to cope with this vectorised code. Unfortunately, it would probably require adding a considerable amount of code to add the same level of support for __SSE__, __SSE2__, __MMX__, etc, that gcc provides. This is marked RFC, because this would be the first use of __CHECKER__ in the git code-base. I have been cherry-picking this on top of any branch I want to check. At first this wasn't too much of a hassle, but now commit 745224e0 has progressed to master ... (last night I cherry-picked this patch approx a dozen times, so I was getting a little irritated! :D ). ATB, Ramsay Jones git-compat-util.h | 2 +- refs.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/git-compat-util.h b/git-compat-util.h index 26e92f1..1aae883 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -731,7 +731,7 @@ void git_qsort(void *base, size_t nmemb, size_t size, #endif #endif -#if defined(__GNUC__) && defined(__x86_64__) +#if defined(__GNUC__) && defined(__x86_64__) && !defined(__CHECKER__) #include <emmintrin.h> /* * This is the system memory page size; it's used so that we can read diff --git a/refs.c b/refs.c index 84b9070..ffd4016 100644 --- a/refs.c +++ b/refs.c @@ -124,7 +124,7 @@ static int check_refname_format_bytewise(const char *refname, int flags) return 0; } -#if defined(__GNUC__) && defined(__x86_64__) +#if defined(__GNUC__) && defined(__x86_64__) && !defined(__CHECKER__) #define SSE_VECTOR_BYTES 16 /* Vectorized version of check_refname_format. */ -- 2.0.0 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html