1. Python CFFI
  2. Untitled project
  3. cffi
Issue #126 resolved

using the "restrict" keyword causes a warning

Antonio Cuni
created an issue

The following snippet produces a warning with gcc on linux:

from cffi import FFI
ffi = FFI()

ffi.cdef(
    """
        struct foo
        {
          void * restrict p;
        };
    """)

lib = ffi.verify(
    """
        struct foo
        {
          void * restrict p;
        };
    """,
    extra_compile_args = ['-std=c99'],
    )
__pycache__/_cffi__x389338f5x3f3c4a3b.c: In function ‘_cffi_check_struct_foo’:
__pycache__/_cffi__x389338f5x3f3c4a3b.c:163:19: warning: initialization discards ‘restrict’ qualifier from pointer target type [enabled by default]

The warning appears also if I don't use "restrict" in the cdef, or if the header file in verify() uses c89 and restrict (e.g. on gcc).

Comments (5)

  1. Log in to comment