On Sun, 1 Jan 2012, SF Markus Elfring wrote:

Probably it does not find the file string.h.

The software package "glibc-devel 2.14.1-14.14.1" is also installed on my opnSUSE 12.1 system.

It's not that it is not there. Coccinelle has to be able to find it, using the -I options that are given to it. But it looks like your problem is with parsing the file, not finding it.

Maybe the -parse_c or -verbose_parsing argument can help you see what files are included.

elfring@Sonne:~/Projekte/Coccinelle/lokal/demos/pass-through> spatch -sp_file list_pass-through_candidates.cocci /usr/include/string.h -I /usr/include -recursive_includes -parse_c
init_defs_builtins: /usr/share/coccinelle/standard.h
warning: seems not a .c file

PARSING: /usr/include/string.h
(ONCE) CPP-MACRO: found known macro = __attribute_pure__
(ONCE) CPP-MACRO: __attributenoarg detected
(ONCE) CPP-MACRO: __attribute detected
(ONCE) CPP-TYPEDEF: promoting: __THROW
(ONCE) CPP-TYPEDEF: promoting: __extern_always_inline
(ONCE) CPP-TYPEDEF: promoting: __attribute_malloc__
(ONCE) CPP-TYPEDEF: promoting: strerror_r
(ONCE) CPP-MACRO: found known macro = strerror_r
(ONCE) CPP-TYPEDEF: promoting: __xpg_strerror_r
passed:__attribute_pure__
passed:__attribute_pure__
passed:__attribute_pure__
passed:__attribute_pure__
passed:__attribute_pure__
passed:__attribute_pure__
passed:__attribute_pure__
passed:__attribute_pure__
passed:__attribute_pure__
passed:__attribute_pure__
passed:__attribute_pure__
passed:__attribute_pure__
passed:__attribute_pure__
passed:__attribute_pure__
passed:__extension__
passed:__extension__
passed:__attribute_pure__
passed:__attribute_pure__
passed:__attribute_pure__
passed:__attribute_pure__
passed:__attribute_pure__
passed:__attribute_pure__
passed:__attribute_pure__
passed:__attribute_pure__
passed:__attribute_pure__
passed:__attribute_pure__
passed:__attribute_pure__
passed:__attribute_pure__
passed:__attribute_pure__
passed:__attribute_pure__
passed:__attribute_pure__
passed:__attribute_pure__
passed:__attribute_pure__
passed:__attribute_pure__
passed:__attribute_pure__
passed:__attribute_pure__
passed:__attribute_pure__
passed:__attribute_pure__
passed:__attribute_pure__
passed:strerror_r
passed:__attribute_pure__
passed:__attribute_pure__
passed:__attribute_pure__
passed:__attribute_pure__
passed:__attribute_pure__
passed:__attribute_pure__
passed:__attribute_pure__
passed:__attribute__ ( ( __const__ ) )
passed:__attribute__ ( ( __const__ ) )
passed:__extension__
passed:__attribute__ ( ( __const__ ) )
passed:__attribute_pure__
passed:__attribute_pure__
passed:__attribute_pure__
passed:__attribute_pure__
passed:__attribute_pure__
-----------------------------------------------------------------------
maybe 10 most problematic tokens
-----------------------------------------------------------------------
__THROW: present in 76 parsing errors
example:
           __THROW __asm ("basename") __nonnull ((1));
      #  else
extern char *basename (__const char *__filename) __THROW __nonnull ((1));
      #  endif
__nonnull: present in 71 parsing errors
example:
           __THROW __asm ("basename") __nonnull ((1));
      #  else
extern char *basename (__const char *__filename) __THROW __nonnull ((1));
      #  endif
__s: present in 37 parsing errors
example:

      /* Frobnicate N bytes of S.  */
      extern void *memfrob (void *__s, size_t __n) __THROW __nonnull ((1));

__n: present in 28 parsing errors
example:

      /* Frobnicate N bytes of S.  */
      extern void *memfrob (void *__s, size_t __n) __THROW __nonnull ((1));

__c: present in 26 parsing errors
example:
      # else
      extern char *rindex (__const char *__s, int __c)
           __THROW __attribute_pure__ __nonnull ((1));
      # endif
__dest: present in 16 parsing errors
example:
      extern char *stpncpy (char *__restrict __dest,
                     __const char *__restrict __src, size_t __n)
           __THROW __nonnull ((1, 2));
      #endif
__src: present in 16 parsing errors
example:
      extern char *stpncpy (char *__restrict __dest,
                     __const char *__restrict __src, size_t __n)
           __THROW __nonnull ((1, 2));
      #endif
__s1: present in 11 parsing errors
example:
/* Compare S1 and S2 as strings holding name & indices/version numbers. */
      extern int strverscmp (__const char *__s1, __const char *__s2)
           __THROW __attribute_pure__ __nonnull ((1, 2));

__s2: present in 11 parsing errors
example:
/* Compare S1 and S2 as strings holding name & indices/version numbers. */
      extern int strverscmp (__const char *__s1, __const char *__s2)
           __THROW __attribute_pure__ __nonnull ((1, 2));

__extern_always_inline: present in 7 parsing errors
example:
      }

      __extern_always_inline __const char *
      rindex (__const char *__s, int __c) __THROW
-----------------------------------------------------------------------
NB total files = 1; perfect = 0; pbs = 1; timeout = 0; =========> 0%
nb good = 33,  nb passed = 56 =========> 169.696970% passed
nb good = 33,  nb bad = 614 =========> 5.100464% good


Do you get a similar result in your test environment?

Undoubtedly. In general, if you are working on some code other than Linux, you will have to spend some time making an appropriate standard.h file to give as the -macro_file argument.

For example, it looks like you would want to put

#define __THROW

in such a file.

julia
_______________________________________________
Cocci mailing list
[email protected]
http://lists.diku.dk/mailman/listinfo/cocci
(Web access from inside DIKUs LAN only)

Reply via email to