On Mon, 2 Jan 2012, SF Markus Elfring wrote:

You would have to send a small example of code that shows a problem.

If I use the following preprocessor settings in my header file "spatch-tweaks.h", ...

#define __THROW
#define __nonnull(X)
#define __const
#define __restrict
#define __BEGIN_NAMESPACE_STD
#define __extern_always_inline
#define __attribute_malloc__

... I get more interesting results.

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 -macro_file spatch-tweaks.h
init_defs_builtins: /usr/share/coccinelle/standard.h
init_defs: spatch-tweaks.h
warning: seems not a .c file
...
-----------------------------------------------------------------------
__s: present in 7 parsing errors
example:
      /* Divide S into tokens separated by characters in DELIM.  Information
         passed between calls are stored in SAVE_PTR.  */
      extern char *__strtok_r (char *__restrict __s,
                        __const char *__restrict __delim,

I don't see the problem here. Perhaps it is in some lines that are not shown.

__c: present in 6 parsing errors
example:
      extern "C++" char *strchrnul (char *__s, int __c)
           __THROW __asm ("strchrnul") __attribute_pure__ __nonnull ((1));

I don't see any solution for this case. There is no way to tell it to ignore "C++" as far as I know. But perhaps parsing this declaration would not be particularly useful to you anyway.

julia


How does the Coccinelle software deal with a preprocessor symbol like "__cplusplus" or "__CORRECT_ISO_CPP_STRING_H_PROTO"?


elfring@Sonne:~/Projekte/Coccinelle/lokal/demos/pass-through> spatch -sp_file list_pass-through_candidates.cocci /usr/include/string.h -I /usr/include -I /usr/include/linux -recursive_includes -macro_file spatch-tweaks.h -c++
init_defs_builtins: /usr/share/coccinelle/standard.h
init_defs: spatch-tweaks.h
HANDLING: /usr/include/string.h
function|"data type"|parameter|"contained in"|"source file"|line|column
__ptsname_r_chk|"int"|__fd||"/usr/include/bits/stdlib.h"|53|8
...

Regards,
Markus

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

Reply via email to