ycm-core / YouCompleteMe

A code-completion engine for Vim
http://ycm-core.github.io/YouCompleteMe/
GNU General Public License v3.0
25.48k stars 2.81k forks source link

YCM shows errors in headers which don't occur during real compilation #2747

Closed klement closed 7 years ago

klement commented 7 years ago

Issue Prelude

Please complete these steps and check these boxes (by putting an x inside the brackets) before filing your issue:

Thank you for adhering to this process! It ensures your issue is resolved quickly and that neither your nor our time is needlessly wasted.

Issue Details

YCM shows errors in headers which don't occur during real compilation.

I'm using 'bear' tool to create compile_commands.json, which is then used by YCM - YcmDebugInfo shows that the compilation database is used, and that the correct compile command is picked from the database.

Now when I perform the compilation - either using gcc or clang, I get the same set of errors, ALL of which are located in a .c file.

The issue is that when I let YCM populate the location list, there are additional errors reported in an included header file, which has a ton of #ifdefs, so it's perfectly possible that it's not cleanly-compilable by default. See below - the errors in ethernet.h and ip6_packet.h are not reported by gcc nor clang...

I couldn't create a minimalistic test case...

Diagnostic data

compile_commands.json entry:

  1308         "command": "cc -c -DPACKAGE_NAME=\\\"vpp\\\" -DPACKAGE_TARNAME=\\\"vpp\\\" -DPACKAGE_VERSION=\\\"17.10\\\" -DPACKAGE_STRING=\\\"vpp        17.10\\\" -DPACKAGE_BUGREPORT=\\\"vpp-dev@fd.io\\\" -DPACKAGE_URL=\\\"\\\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_       STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -       DLT_OBJDIR=\\\".libs/\\\" -DPACKAGE=\\\"vpp\\\" -DVERSION=\\\"17.10\\\" -DDPDK_SHARED_LIB=0 -DWITH_LIBSSL=1 -I/home/ksekera/vpp/build-root/b       uild-vpp_debug-native/vpp -I/home/ksekera/vpp/src -I/home/ksekera/vpp/build-root/install-vpp_debug-native/dpdk/include/dpdk -I/usr/include/d       pdk -Wall -g -O0 -DCLIB_DEBUG -DFORTIFY_SOURCE=2 -march=corei7 -fstack-protector-all -fPIC -Werror -fPIC -DPIC -o vnet/l2/.libs/l2_fib.o /ho       me/ksekera/vpp/src/vnet/l2/l2_fib.c",
  1309         "directory": "/home/ksekera/vpp/build-root/build-vpp_debug-native/vpp",
  1310         "file": "/home/ksekera/vpp/src/vnet/l2/l2_fib.c"

gcc errors while compiling the file

In file included from /home/ksekera/vpp/src/vppinfra/cuckoo_8_8.h:98:0,
                 from /home/ksekera/vpp/src/vnet/l2/l2_fib.c:19:
/home/ksekera/vpp/src/vnet/l2/l2_fib.c: In function ‘l2fib_table_dump’:
/home/ksekera/vpp/src/vnet/l2/l2_fib.c:82:8: error: unknown type name ‘clib_cuckoo_value_8_8_t’
   CVT (clib_cuckoo_value) * v;
        ^
/home/ksekera/vpp/src/vppinfra/cuckoo_template.h:83:21: note: in expansion of macro ‘_cvt’
 #define __cvt(a, b) _cvt (a, b)
                     ^
/home/ksekera/vpp/src/vppinfra/cuckoo_template.h:84:16: note: in expansion of macro ‘__cvt’
 #define CVT(a) __cvt (a, CLIB_CUCKOO_TYPE)
                ^
/home/ksekera/vpp/src/vnet/l2/l2_fib.c:82:3: note: in expansion of macro ‘CVT’
   CVT (clib_cuckoo_value) * v;
   ^
/home/ksekera/vpp/src/vnet/l2/l2_fib.c:87:20: error: ‘clib_cuckoo_8_8_t {aka struct clib_cuckoo_8_8}’ has no member named ‘nbuckets’
   for (i = 0; i < h->nbuckets; i++)
                    ^
/home/ksekera/vpp/src/vnet/l2/l2_fib.c:90:12: error: ‘clib_cuckoo_bucket_8_8_t {aka struct <anonymous>}’ has no member named ‘offset’
       if (b->offset == 0)
            ^
In file included from /home/ksekera/vpp/src/vppinfra/cuckoo_8_8.h:98:0,
                 from /home/ksekera/vpp/src/vnet/l2/l2_fib.c:19:
/home/ksekera/vpp/src/vnet/l2/l2_fib.c:92:15: error: implicit declaration of function ‘clib_cuckoo_get_value_8_8’ [-Werror=implicit-function-declaration]
       v = CV (clib_cuckoo_get_value) (h, b->offset);
               ^
/home/ksekera/vpp/src/vppinfra/cuckoo_template.h:78:19: note: in definition of macro ‘_cv’
 #define _cv(a, b) a##b
                   ^
/home/ksekera/vpp/src/vppinfra/cuckoo_template.h:80:15: note: in expansion of macro ‘__cv’
 #define CV(a) __cv (a, CLIB_CUCKOO_TYPE)
               ^
/home/ksekera/vpp/src/vnet/l2/l2_fib.c:92:11: note: in expansion of macro ‘CV’
       v = CV (clib_cuckoo_get_value) (h, b->offset);
           ^
/home/ksekera/vpp/src/vnet/l2/l2_fib.c:92:43: error: ‘clib_cuckoo_bucket_8_8_t {aka struct <anonymous>}’ has no member named ‘offset’
       v = CV (clib_cuckoo_get_value) (h, b->offset);
                                           ^
/home/ksekera/vpp/src/vnet/l2/l2_fib.c:93:30: error: ‘clib_cuckoo_bucket_8_8_t {aka struct <anonymous>}’ has no member named ‘log2_pages’
       for (j = 0; j < (1 << b->log2_pages); j++)
                              ^
/home/ksekera/vpp/src/vnet/l2/l2_fib.c:97:13: error: request for member ‘kvp’ in something not a structure or union
        if (v->kvp[k].key == ~0ULL && v->kvp[k].value == ~0ULL)
             ^
/home/ksekera/vpp/src/vnet/l2/l2_fib.c:97:39: error: request for member ‘kvp’ in something not a structure or union
        if (v->kvp[k].key == ~0ULL && v->kvp[k].value == ~0ULL)
                                       ^
/home/ksekera/vpp/src/vnet/l2/l2_fib.c:100:19: error: request for member ‘kvp’ in something not a structure or union
        key.raw = v->kvp[k].key;
                   ^
/home/ksekera/vpp/src/vnet/l2/l2_fib.c:101:22: error: request for member ‘kvp’ in something not a structure or union
        result.raw = v->kvp[k].value;
                      ^
In file included from /home/ksekera/vpp/src/vppinfra/cuckoo_8_8.h:98:0,
                 from /home/ksekera/vpp/src/vnet/l2/l2_fib.c:19:
/home/ksekera/vpp/src/vnet/l2/l2_fib.c: In function ‘show_l2fib’:
/home/ksekera/vpp/src/vnet/l2/l2_fib.c:124:8: error: unknown type name ‘clib_cuckoo_value_8_8_t’
   CVT (clib_cuckoo_value) * v;
        ^
/home/ksekera/vpp/src/vppinfra/cuckoo_template.h:82:20: note: in definition of macro ‘_cvt’
 #define _cvt(a, b) a##b##_t
                    ^
/home/ksekera/vpp/src/vppinfra/cuckoo_template.h:84:16: note: in expansion of macro ‘__cvt’
 #define CVT(a) __cvt (a, CLIB_CUCKOO_TYPE)
                ^
/home/ksekera/vpp/src/vnet/l2/l2_fib.c:124:3: note: in expansion of macro ‘CVT’
   CVT (clib_cuckoo_value) * v;
   ^
/home/ksekera/vpp/src/vnet/l2/l2_fib.c:164:20: error: ‘clib_cuckoo_8_8_t {aka struct clib_cuckoo_8_8}’ has no member named ‘nbuckets’
   for (i = 0; i < h->nbuckets; i++)
                    ^
/home/ksekera/vpp/src/vnet/l2/l2_fib.c:167:12: error: ‘clib_cuckoo_bucket_8_8_t {aka struct <anonymous>}’ has no member named ‘offset’
       if (b->offset == 0)
            ^
/home/ksekera/vpp/src/vnet/l2/l2_fib.c:169:43: error: ‘clib_cuckoo_bucket_8_8_t {aka struct <anonymous>}’ has no member named ‘offset’
       v = CV (clib_cuckoo_get_value) (h, b->offset);
                                           ^
/home/ksekera/vpp/src/vnet/l2/l2_fib.c:170:30: error: ‘clib_cuckoo_bucket_8_8_t {aka struct <anonymous>}’ has no member named ‘log2_pages’
       for (j = 0; j < (1 << b->log2_pages); j++)
                              ^
/home/ksekera/vpp/src/vnet/l2/l2_fib.c:174:13: error: request for member ‘kvp’ in something not a structure or union
        if (v->kvp[k].key == ~0ULL && v->kvp[k].value == ~0ULL)
             ^
/home/ksekera/vpp/src/vnet/l2/l2_fib.c:174:39: error: request for member ‘kvp’ in something not a structure or union
        if (v->kvp[k].key == ~0ULL && v->kvp[k].value == ~0ULL)
                                       ^
/home/ksekera/vpp/src/vnet/l2/l2_fib.c:187:19: error: request for member ‘kvp’ in something not a structure or union
        key.raw = v->kvp[k].key;
                   ^
/home/ksekera/vpp/src/vnet/l2/l2_fib.c:188:22: error: request for member ‘kvp’ in something not a structure or union
        result.raw = v->kvp[k].value;
                      ^
In file included from /home/ksekera/vpp/src/vnet/l2/l2_fib.c:29:0:
/home/ksekera/vpp/src/vnet/l2/l2_fib.c: In function ‘l2fib_clear_table’:
/home/ksekera/vpp/src/vnet/l2/l2_fib.h:28:27: error: passing argument 4 of ‘clib_cuckoo_init_8_8’ makes pointer from integer without a cast [-Werror=int-conversion]
 #define L2FIB_MEMORY_SIZE (256<<20)
                           ^
/home/ksekera/vpp/src/vnet/l2/l2_fib.c:295:24: note: in expansion of macro ‘L2FIB_MEMORY_SIZE’
     L2FIB_NUM_BUCKETS, L2FIB_MEMORY_SIZE);
                        ^
In file included from /home/ksekera/vpp/src/vppinfra/cuckoo_8_8.h:98:0,
                 from /home/ksekera/vpp/src/vnet/l2/l2_fib.c:19:
/home/ksekera/vpp/src/vppinfra/cuckoo_template.c:161:10: note: expected ‘void (*)(clib_cuckoo_8_8_t *, void *) {aka void (*)(struct clib_cuckoo_8_8 *, void *)}’ but argument is of type ‘int’
 void CV (clib_cuckoo_init) (
          ^
/home/ksekera/vpp/src/vppinfra/cuckoo_template.h:78:19: note: in definition of macro ‘_cv’
 #define _cv(a, b) a##b
                   ^
/home/ksekera/vpp/src/vppinfra/cuckoo_template.h:80:15: note: in expansion of macro ‘__cv’
 #define CV(a) __cv (a, CLIB_CUCKOO_TYPE)
               ^
/home/ksekera/vpp/src/vppinfra/cuckoo_template.c:161:6: note: in expansion of macro ‘CV’
 void CV (clib_cuckoo_init) (
      ^
/home/ksekera/vpp/src/vnet/l2/l2_fib.c:294:7: error: too few arguments to function ‘clib_cuckoo_init_8_8’
   CV (clib_cuckoo_init) (&mp->mac_table, "l2fib mac table",
       ^
/home/ksekera/vpp/src/vppinfra/cuckoo_template.h:78:19: note: in definition of macro ‘_cv’
 #define _cv(a, b) a##b
                   ^
/home/ksekera/vpp/src/vppinfra/cuckoo_template.h:80:15: note: in expansion of macro ‘__cv’
 #define CV(a) __cv (a, CLIB_CUCKOO_TYPE)
               ^
/home/ksekera/vpp/src/vnet/l2/l2_fib.c:294:3: note: in expansion of macro ‘CV’
   CV (clib_cuckoo_init) (&mp->mac_table, "l2fib mac table",
   ^
/home/ksekera/vpp/src/vppinfra/cuckoo_template.c:161:10: note: declared here
 void CV (clib_cuckoo_init) (
          ^
/home/ksekera/vpp/src/vppinfra/cuckoo_template.h:78:19: note: in definition of macro ‘_cv’
 #define _cv(a, b) a##b
                   ^
/home/ksekera/vpp/src/vppinfra/cuckoo_template.h:80:15: note: in expansion of macro ‘__cv’
 #define CV(a) __cv (a, CLIB_CUCKOO_TYPE)
               ^
/home/ksekera/vpp/src/vppinfra/cuckoo_template.c:161:6: note: in expansion of macro ‘CV’
 void CV (clib_cuckoo_init) (
      ^
/home/ksekera/vpp/src/vnet/l2/l2_fib.c: In function ‘l2fib_scan’:
/home/ksekera/vpp/src/vnet/l2/l2_fib.c:982:20: error: ‘clib_cuckoo_8_8_t {aka struct clib_cuckoo_8_8}’ has no member named ‘nbuckets’
   for (i = 0; i < h->nbuckets; i++)
                    ^
/home/ksekera/vpp/src/vnet/l2/l2_fib.c:993:17: error: ‘clib_cuckoo_8_8_t {aka struct clib_cuckoo_8_8}’ has no member named ‘nbuckets’
       if (i < (h->nbuckets - 3))
                 ^
/home/ksekera/vpp/src/vnet/l2/l2_fib.c:998:9: error: ‘clib_cuckoo_bucket_8_8_t {aka struct <anonymous>}’ has no member named ‘offset’
    if (b->offset)
         ^
In file included from /home/ksekera/vpp/src/vppinfra/cuckoo_8_8.h:98:0,
                 from /home/ksekera/vpp/src/vnet/l2/l2_fib.c:19:
/home/ksekera/vpp/src/vnet/l2/l2_fib.c:1000:13: error: unknown type name ‘clib_cuckoo_value_8_8_t’
        CVT (clib_cuckoo_value) * v =
             ^
/home/ksekera/vpp/src/vppinfra/cuckoo_template.h:82:20: note: in definition of macro ‘_cvt’
 #define _cvt(a, b) a##b##_t
                    ^
/home/ksekera/vpp/src/vppinfra/cuckoo_template.h:84:16: note: in expansion of macro ‘__cvt’
 #define CVT(a) __cvt (a, CLIB_CUCKOO_TYPE)
                ^
/home/ksekera/vpp/src/vnet/l2/l2_fib.c:1000:8: note: in expansion of macro ‘CVT’
        CVT (clib_cuckoo_value) * v =
        ^
/home/ksekera/vpp/src/vnet/l2/l2_fib.c:1001:35: error: ‘clib_cuckoo_bucket_8_8_t {aka struct <anonymous>}’ has no member named ‘offset’
   CV (clib_cuckoo_get_value) (h, b->offset);
                                   ^
/home/ksekera/vpp/src/vnet/l2/l2_fib.c:1007:12: error: ‘clib_cuckoo_bucket_8_8_t {aka struct <anonymous>}’ has no member named ‘offset’
       if (b->offset == 0)
            ^
In file included from /home/ksekera/vpp/src/vppinfra/cuckoo_8_8.h:98:0,
                 from /home/ksekera/vpp/src/vnet/l2/l2_fib.c:19:
/home/ksekera/vpp/src/vnet/l2/l2_fib.c:1009:12: error: unknown type name ‘clib_cuckoo_value_8_8_t’
       CVT (clib_cuckoo_value) * v = CV (clib_cuckoo_get_value) (h, b->offset);
            ^
/home/ksekera/vpp/src/vppinfra/cuckoo_template.h:82:20: note: in definition of macro ‘_cvt’
 #define _cvt(a, b) a##b##_t
                    ^
/home/ksekera/vpp/src/vppinfra/cuckoo_template.h:84:16: note: in expansion of macro ‘__cvt’
 #define CVT(a) __cvt (a, CLIB_CUCKOO_TYPE)
                ^
/home/ksekera/vpp/src/vnet/l2/l2_fib.c:1009:7: note: in expansion of macro ‘CVT’
       CVT (clib_cuckoo_value) * v = CV (clib_cuckoo_get_value) (h, b->offset);
       ^
/home/ksekera/vpp/src/vnet/l2/l2_fib.c:1009:69: error: ‘clib_cuckoo_bucket_8_8_t {aka struct <anonymous>}’ has no member named ‘offset’
       CVT (clib_cuckoo_value) * v = CV (clib_cuckoo_get_value) (h, b->offset);
                                                                     ^
/home/ksekera/vpp/src/vnet/l2/l2_fib.c:1010:30: error: ‘clib_cuckoo_bucket_8_8_t {aka struct <anonymous>}’ has no member named ‘log2_pages’
       for (j = 0; j < (1 << b->log2_pages); j++)
                              ^
/home/ksekera/vpp/src/vnet/l2/l2_fib.c:1014:13: error: request for member ‘kvp’ in something not a structure or union
        if (v->kvp[k].key == ~0ULL && v->kvp[k].value == ~0ULL)
             ^
/home/ksekera/vpp/src/vnet/l2/l2_fib.c:1014:39: error: request for member ‘kvp’ in something not a structure or union
        if (v->kvp[k].key == ~0ULL && v->kvp[k].value == ~0ULL)
                                       ^
/home/ksekera/vpp/src/vnet/l2/l2_fib.c:1017:41: error: request for member ‘kvp’ in something not a structure or union
        l2fib_entry_key_t key = {.raw = v->kvp[k].key };
                                         ^
/home/ksekera/vpp/src/vnet/l2/l2_fib.c:1018:47: error: request for member ‘kvp’ in something not a structure or union
        l2fib_entry_result_t result = {.raw = v->kvp[k].value };
                                               ^
In file included from /home/ksekera/vpp/src/vnet/l2/l2_fib.c:29:0:
/home/ksekera/vpp/src/vnet/l2/l2_fib.c: In function ‘l2fib_init’:
/home/ksekera/vpp/src/vnet/l2/l2_fib.h:28:27: error: passing argument 4 of ‘clib_cuckoo_init_8_8’ makes pointer from integer without a cast [-Werror=int-conversion]
 #define L2FIB_MEMORY_SIZE (256<<20)
                           ^
/home/ksekera/vpp/src/vnet/l2/l2_fib.c:1237:24: note: in expansion of macro ‘L2FIB_MEMORY_SIZE’
     L2FIB_NUM_BUCKETS, L2FIB_MEMORY_SIZE);
                        ^
In file included from /home/ksekera/vpp/src/vppinfra/cuckoo_8_8.h:98:0,
                 from /home/ksekera/vpp/src/vnet/l2/l2_fib.c:19:
/home/ksekera/vpp/src/vppinfra/cuckoo_template.c:161:10: note: expected ‘void (*)(clib_cuckoo_8_8_t *, void *) {aka void (*)(struct clib_cuckoo_8_8 *, void *)}’ but argument is of type ‘int’
 void CV (clib_cuckoo_init) (
          ^
/home/ksekera/vpp/src/vppinfra/cuckoo_template.h:78:19: note: in definition of macro ‘_cv’
 #define _cv(a, b) a##b
                   ^
/home/ksekera/vpp/src/vppinfra/cuckoo_template.h:80:15: note: in expansion of macro ‘__cv’
 #define CV(a) __cv (a, CLIB_CUCKOO_TYPE)
               ^
/home/ksekera/vpp/src/vppinfra/cuckoo_template.c:161:6: note: in expansion of macro ‘CV’
 void CV (clib_cuckoo_init) (
      ^
/home/ksekera/vpp/src/vnet/l2/l2_fib.c:1236:7: error: too few arguments to function ‘clib_cuckoo_init_8_8’
   CV (clib_cuckoo_init) (&mp->mac_table, "l2fib mac table",
       ^
/home/ksekera/vpp/src/vppinfra/cuckoo_template.h:78:19: note: in definition of macro ‘_cv’
 #define _cv(a, b) a##b
                   ^
/home/ksekera/vpp/src/vppinfra/cuckoo_template.h:80:15: note: in expansion of macro ‘__cv’
 #define CV(a) __cv (a, CLIB_CUCKOO_TYPE)
               ^
/home/ksekera/vpp/src/vnet/l2/l2_fib.c:1236:3: note: in expansion of macro ‘CV’
   CV (clib_cuckoo_init) (&mp->mac_table, "l2fib mac table",
   ^
/home/ksekera/vpp/src/vppinfra/cuckoo_template.c:161:10: note: declared here
 void CV (clib_cuckoo_init) (
          ^
/home/ksekera/vpp/src/vppinfra/cuckoo_template.h:78:19: note: in definition of macro ‘_cv’
 #define _cv(a, b) a##b
                   ^
/home/ksekera/vpp/src/vppinfra/cuckoo_template.h:80:15: note: in expansion of macro ‘__cv’
 #define CV(a) __cv (a, CLIB_CUCKOO_TYPE)
               ^
/home/ksekera/vpp/src/vppinfra/cuckoo_template.c:161:6: note: in expansion of macro ‘CV’
 void CV (clib_cuckoo_init) (
      ^
cc1: all warnings being treated as errors

clang errors while compiling the file

/home/ksekera/vpp/src/vnet/l2/l2_fib.c:82:3: error: use of undeclared identifier 'clib_cuckoo_value_8_8_t'
  CVT (clib_cuckoo_value) * v;
  ^
/home/ksekera/vpp/src/vppinfra/cuckoo_template.h:84:16: note: expanded from macro 'CVT'
#define CVT(a) __cvt (a, CLIB_CUCKOO_TYPE)
               ^
/home/ksekera/vpp/src/vppinfra/cuckoo_template.h:83:21: note: expanded from macro '__cvt'
#define __cvt(a, b) _cvt (a, b)
                    ^
/home/ksekera/vpp/src/vppinfra/cuckoo_template.h:82:20: note: expanded from macro '_cvt'
#define _cvt(a, b) a##b##_t
                   ^
<scratch space>:190:1: note: expanded from here
clib_cuckoo_value_8_8_t
^
/home/ksekera/vpp/src/vnet/l2/l2_fib.c:82:29: error: use of undeclared identifier 'v'
  CVT (clib_cuckoo_value) * v;
                            ^
/home/ksekera/vpp/src/vnet/l2/l2_fib.c:87:22: error: no member named 'nbuckets' in 'struct clib_cuckoo_8_8'; did you mean 'buckets'?
  for (i = 0; i < h->nbuckets; i++)
                     ^~~~~~~~
                     buckets
/home/ksekera/vpp/src/vppinfra/cuckoo_template.h:244:39: note: 'buckets' declared here
  _Atomic(CVT (clib_cuckoo_bucket) *) buckets;
                                      ^
/home/ksekera/vpp/src/vnet/l2/l2_fib.c:87:17: error: ordered comparison between pointer and integer ('int' and 'clib_cuckoo_bucket_8_8_t *') [-Werror]
  for (i = 0; i < h->nbuckets; i++)
              ~ ^ ~~~~~~~~~~~
/home/ksekera/vpp/src/vnet/l2/l2_fib.c:90:14: error: no member named 'offset' in 'clib_cuckoo_bucket_8_8_t'
      if (b->offset == 0)
          ~  ^
/home/ksekera/vpp/src/vnet/l2/l2_fib.c:92:7: error: use of undeclared identifier 'v'
      v = CV (clib_cuckoo_get_value) (h, b->offset);
      ^
/home/ksekera/vpp/src/vnet/l2/l2_fib.c:92:11: error: implicit declaration of function 'clib_cuckoo_get_value_8_8' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
      v = CV (clib_cuckoo_get_value) (h, b->offset);
          ^
/home/ksekera/vpp/src/vppinfra/cuckoo_template.h:80:15: note: expanded from macro 'CV'
#define CV(a) __cv (a, CLIB_CUCKOO_TYPE)
              ^
/home/ksekera/vpp/src/vppinfra/cuckoo_template.h:79:20: note: expanded from macro '__cv'
#define __cv(a, b) _cv (a, b)
                   ^
/home/ksekera/vpp/src/vppinfra/cuckoo_template.h:78:19: note: expanded from macro '_cv'
#define _cv(a, b) a##b
                  ^
<scratch space>:190:1: note: expanded from here
clib_cuckoo_get_value_8_8
^
/home/ksekera/vpp/src/vnet/l2/l2_fib.c:92:11: note: did you mean 'clib_cuckoo_set_elt_8_8'?
/home/ksekera/vpp/src/vppinfra/cuckoo_template.h:80:15: note: expanded from macro 'CV'
#define CV(a) __cv (a, CLIB_CUCKOO_TYPE)
              ^
/home/ksekera/vpp/src/vppinfra/cuckoo_template.h:79:20: note: expanded from macro '__cv'
#define __cv(a, b) _cv (a, b)
                   ^
/home/ksekera/vpp/src/vppinfra/cuckoo_template.h:78:19: note: expanded from macro '_cv'
#define _cv(a, b) a##b
                  ^
<scratch space>:190:1: note: expanded from here
clib_cuckoo_get_value_8_8
^
/home/ksekera/vpp/src/vppinfra/cuckoo_template.c:549:13: note: 'clib_cuckoo_set_elt_8_8' declared here
static void CV (clib_cuckoo_set_elt) (CVT (clib_cuckoo_bucket) * b,
            ^
/home/ksekera/vpp/src/vppinfra/cuckoo_template.h:80:15: note: expanded from macro 'CV'
#define CV(a) __cv (a, CLIB_CUCKOO_TYPE)
              ^
/home/ksekera/vpp/src/vppinfra/cuckoo_template.h:79:20: note: expanded from macro '__cv'
#define __cv(a, b) _cv (a, b)
                   ^
/home/ksekera/vpp/src/vppinfra/cuckoo_template.h:78:19: note: expanded from macro '_cv'
#define _cv(a, b) a##b
                  ^
<scratch space>:116:1: note: expanded from here
clib_cuckoo_set_elt_8_8
^
/home/ksekera/vpp/src/vnet/l2/l2_fib.c:92:45: error: no member named 'offset' in 'clib_cuckoo_bucket_8_8_t'
      v = CV (clib_cuckoo_get_value) (h, b->offset);
                                         ~  ^
/home/ksekera/vpp/src/vnet/l2/l2_fib.c:93:32: error: no member named 'log2_pages' in 'clib_cuckoo_bucket_8_8_t'
      for (j = 0; j < (1 << b->log2_pages); j++)
                            ~  ^
/home/ksekera/vpp/src/vnet/l2/l2_fib.c:97:12: error: use of undeclared identifier 'v'
              if (v->kvp[k].key == ~0ULL && v->kvp[k].value == ~0ULL)
                  ^
/home/ksekera/vpp/src/vnet/l2/l2_fib.c:97:38: error: use of undeclared identifier 'v'
              if (v->kvp[k].key == ~0ULL && v->kvp[k].value == ~0ULL)
                                            ^
/home/ksekera/vpp/src/vnet/l2/l2_fib.c:100:18: error: use of undeclared identifier 'v'
              key.raw = v->kvp[k].key;
                        ^
/home/ksekera/vpp/src/vnet/l2/l2_fib.c:101:21: error: use of undeclared identifier 'v'
              result.raw = v->kvp[k].value;
                           ^
/home/ksekera/vpp/src/vnet/l2/l2_fib.c:109:4: error: use of undeclared identifier 'v'
          v++;
          ^
/home/ksekera/vpp/src/vnet/l2/l2_fib.c:124:3: error: use of undeclared identifier 'clib_cuckoo_value_8_8_t'
  CVT (clib_cuckoo_value) * v;
  ^
/home/ksekera/vpp/src/vppinfra/cuckoo_template.h:84:16: note: expanded from macro 'CVT'
#define CVT(a) __cvt (a, CLIB_CUCKOO_TYPE)
               ^
/home/ksekera/vpp/src/vppinfra/cuckoo_template.h:83:21: note: expanded from macro '__cvt'
#define __cvt(a, b) _cvt (a, b)
                    ^
/home/ksekera/vpp/src/vppinfra/cuckoo_template.h:82:20: note: expanded from macro '_cvt'
#define _cvt(a, b) a##b##_t
                   ^
<scratch space>:190:1: note: expanded from here
clib_cuckoo_value_8_8_t
^
/home/ksekera/vpp/src/vnet/l2/l2_fib.c:124:29: error: use of undeclared identifier 'v'
  CVT (clib_cuckoo_value) * v;
                            ^
/home/ksekera/vpp/src/vnet/l2/l2_fib.c:164:22: error: no member named 'nbuckets' in 'struct clib_cuckoo_8_8'; did you mean 'buckets'?
  for (i = 0; i < h->nbuckets; i++)
                     ^~~~~~~~
                     buckets
/home/ksekera/vpp/src/vppinfra/cuckoo_template.h:244:39: note: 'buckets' declared here
  _Atomic(CVT (clib_cuckoo_bucket) *) buckets;
                                      ^
/home/ksekera/vpp/src/vnet/l2/l2_fib.c:164:17: error: ordered comparison between pointer and integer ('int' and 'clib_cuckoo_bucket_8_8_t *') [-Werror]
  for (i = 0; i < h->nbuckets; i++)
              ~ ^ ~~~~~~~~~~~
/home/ksekera/vpp/src/vnet/l2/l2_fib.c:167:14: error: no member named 'offset' in 'clib_cuckoo_bucket_8_8_t'
      if (b->offset == 0)
          ~  ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.

location list contents in vim

1   src/vnet/l2/l2_fib.c [c,utf-8,unix]     ⬥ ok                                                     cCommentStart 42,0x2A       16,2            0%
  1 src/vnet/ethernet/ethernet.h|68 col 49 error| implicit conversion from 'int' to 'short' changes value from 33024 to -32512
  2 src/vnet/ethernet/ethernet.h|69 col 7 error| implicit conversion from 'int' to 'short' changes value from 34984 to -30552
  3 src/vnet/ethernet/ethernet.h|70 col 7 error| implicit conversion from 'int' to 'short' changes value from 37120 to -28416
  4 src/vnet/ethernet/ethernet.h|71 col 7 error| implicit conversion from 'int' to 'short' changes value from 37376 to -28160
  5 src/vnet/ethernet/ethernet.h|74 col 7 error| implicit conversion from 'int' to 'short' changes value from 37376 to -28160
  6 src/vnet/ethernet/ethernet.h|75 col 7 error| implicit conversion from 'int' to 'short' changes value from 37376 to -28160
  7 src/vnet/ethernet/ethernet.h|76 col 7 error| implicit conversion from 'int' to 'short' changes value from 37376 to -28160
  8 src/vnet/ethernet/ethernet.h|77 col 7 error| implicit conversion from 'int' to 'short' changes value from 37376 to -28160
  9 src/vnet/ip/ip6_packet.h|153 col 63 error| taking address of packed member '' of class or structure 'ip46_address_t' may result in an unaligned     pointer value
 10 src/vnet/ip/ip6_packet.h|154 col 32 error| taking address of packed member 'ip6' of class or structure 'ip46_address_t' may result in an unalig    ned pointer value                                                                                                                               
 11 src/vnet/l2/l2_fib.c|4 col 24 error| missing terminating '"' character
 12 src/vnet/l2/l2_fib.c|82 col 3 error| use of undeclared identifier 'clib_cuckoo_value_8_8_t'
 13 src/vnet/l2/l2_fib.c|82 col 29 error| use of undeclared identifier 'v'                                                                          
 14 src/vnet/l2/l2_fib.c|87 col 22 error| no member named 'nbuckets' in 'struct clib_cuckoo_8_8'                                                    
 15 src/vnet/l2/l2_fib.c|90 col 14 error| no member named 'offset' in 'clib_cuckoo_bucket_8_8_t'                                                    
 16 src/vnet/l2/l2_fib.c|92 col 7 error| use of undeclared identifier 'v'                                                                           
 17 src/vnet/l2/l2_fib.c|92 col 11 error| implicit declaration of function 'clib_cuckoo_get_value_8_8' is invalid in C99 (FixIt available)          
 18 src/vnet/l2/l2_fib.c|92 col 45 error| no member named 'offset' in 'clib_cuckoo_bucket_8_8_t'                                                    
 19 src/vnet/l2/l2_fib.c|93 col 32 error| no member named 'log2_pages' in 'clib_cuckoo_bucket_8_8_t'
 20 src/vnet/l2/l2_fib.c|97 col 12 error| use of undeclared identifier 'v'                                                                          
 21 src/vnet/l2/l2_fib.c|97 col 38 error| use of undeclared identifier 'v'                                                                          
 22 src/vnet/l2/l2_fib.c|100 col 18 error| use of undeclared identifier 'v'                                                                         
 23 src/vnet/l2/l2_fib.c|101 col 21 error| use of undeclared identifier 'v'                                                                         
 24 src/vnet/l2/l2_fib.c|109 col 4 error| use of undeclared identifier 'v'                                                                          
 25 src/vnet/l2/l2_fib.c|124 col 3 error| use of undeclared identifier 'clib_cuckoo_value_8_8_t'
 26 src/vnet/l2/l2_fib.c|124 col 29 error| use of undeclared identifier 'v'
 27 src/vnet/l2/l2_fib.c|164 col 22 error| no member named 'nbuckets' in 'struct clib_cuckoo_8_8'
 28 src/vnet/l2/l2_fib.c|167 col 14 error| no member named 'offset' in 'clib_cuckoo_bucket_8_8_t'
 29 src/vnet/l2/l2_fib.c|169 col 7 error| use of undeclared identifier 'v'
[Location List] :setloclist()                                                                                                   1,1             All
Diagnostics refreshed

Output of vim --version

VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Feb 21 2017 03:50:47)
Included patches: 1-329
Compiled by ksekera@zglab-host-4
Huge version without GUI.  Features included (+) or not (-):
+acl             +file_in_path    +mouse_sgr       +tag_old_static
+arabic          +find_in_path    -mouse_sysmouse  -tag_any_white
+autocmd         +float           +mouse_urxvt     -tcl
-balloon_eval    +folding         +mouse_xterm     +termguicolors
-browse          -footer          +multi_byte      +terminfo
++builtin_terms  +fork()          +multi_lang      +termresponse
+byte_offset     +gettext         -mzscheme        +textobjects
+channel         -hangul_input    +netbeans_intg   +timers
+cindent         +iconv           +num64           +title
-clientserver    +insert_expand   +packages        -toolbar
-clipboard       +job             +path_extra      +user_commands
+cmdline_compl   +jumplist        -perl            +vertsplit
+cmdline_hist    +keymap          +persistent_undo +virtualedit
+cmdline_info    +lambda          +postscript      +visual
+comments        +langmap         +printer         +visualextra
+conceal         +libcall         +profile         +viminfo
+cryptv          +linebreak       +python          +vreplace
+cscope          +lispindent      -python3         +wildignore
+cursorbind      +listcmds        +quickfix        +wildmenu
+cursorshape     +localmap        +reltime         +windows
+dialog_con      -lua             +rightleft       +writebackup
+diff            +menu            -ruby            -X11
+digraphs        +mksession       +scrollbind      -xfontset
-dnd             +modify_fname    +signs           -xim
-ebcdic          +mouse           +smartindent     -xpm
+emacs_tags      -mouseshape      +startuptime     -xsmp
+eval            +mouse_dec       +statusline      -xterm_clipboard
+ex_extra        -mouse_gpm       -sun_workshop    -xterm_save
+extra_search    -mouse_jsbterm   +syntax
+farsi           +mouse_netterm   +tag_binary
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
  fall-back for $VIM: "/home/ksekera/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H     -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc   -L/usr/local/lib -Wl,--as-needed -o vim        -lm -ltinfo -lnsl   -ldl    -L/usr/lib/python2.7/ -lpython2.7

Output of YcmDebugInfo

Printing YouCompleteMe debug information...
-- Client logfile: /tmp/ycm_Fo2HnV.log
-- Server Python interpreter: /usr/bin/python
-- Server Python version: 2.7.12
-- Server has Clang support compiled in: True
-- Clang version: clang version 4.0.1 (tags/RELEASE_401/final)
-- No extra configuration file found
-- C-family completer debug information:
--   Compilation database path: /home/ksekera
--   Flags: ['cc', '-DPACKAGE_NAME="vpp"', '-DPACKAGE_TARNAME="vpp"', '-DPACKAGE_VERSION="17.10"', '-DPACKAGE_STRING="vpp', '17.10"', '-DPACKAGE_BU
GREPORT="vpp-dev@fd.io"', '-DPACKAGE_URL=""', '-DSTDC_HEADERS=1', '-DHAVE_SYS_TYPES_H=1', '-DHAVE_SYS_STAT_H=1', '-DHAVE_STDLIB_H=1', '-DHAVE_STRIN
G_H=1', '-DHAVE_MEMORY_H=1', '-DHAVE_STRINGS_H=1', '-DHAVE_INTTYPES_H=1', '-DHAVE_STDINT_H=1', '-DHAVE_UNISTD_H=1', '-DHAVE_DLFCN_H=1', '-DLT_OBJDI
R=".libs/"', '-DPACKAGE="vpp"', '-DVERSION="17.10"', '-DDPDK_SHARED_LIB=0', '-DWITH_LIBSSL=1', '-I/home/ksekera/vpp/build-root/build-vpp_debug-nati
ve/vpp', '-I/home/ksekera/vpp/src', '-I/home/ksekera/vpp/build-root/install-vpp_debug-native/dpdk/include/dpdk', '-I/usr/include/dpdk', '-Wall', '-
g', '-O0', '-DCLIB_DEBUG', '-DFORTIFY_SOURCE=2', '-march=corei7', '-fstack-protector-all', '-fPIC', '-Werror', '-fPIC', '-DPIC', '-resource-dir=/ho
me/ksekera/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../clang_includes', '-fspell-checking']
-- Server running at: http://127.0.0.1:46232
-- Server process ID: 10855
-- Server logfiles:
--   /tmp/ycmd_46232_stdout_XqIQLS.log
--   /tmp/ycmd_46232_stderr_bKFAxQ.log

Contents of YCM, ycmd and completion engine logfiles

  1 2017-08-11 05:20:19,137 - ERROR - Error while handling server response
  2 Traceback (most recent call last):
  3   File "/home/ksekera/.vim/bundle/YouCompleteMe/autoload/../python/ycm/client/base_request.py", line 214, in HandleServerException
  4     yield
  5   File "/home/ksekera/.vim/bundle/YouCompleteMe/autoload/../python/ycm/client/event_notification.py", line 61, in Response
  6     self._cached_response = JsonFromFuture( self._response_future )
  7   File "/home/ksekera/.vim/bundle/YouCompleteMe/autoload/../python/ycm/client/base_request.py", line 183, in JsonFromFuture
  8     raise MakeServerException( response.json() )
  9 ServerError: ValueError: Still no compile flags, no completions yet.
 10 2017-08-11 05:21:25,447 - ERROR - Error while handling server response
 11 Traceback (most recent call last):
 12   File "/home/ksekera/.vim/bundle/YouCompleteMe/autoload/../python/ycm/client/base_request.py", line 214, in HandleServerException
 13     yield
 14   File "/home/ksekera/.vim/bundle/YouCompleteMe/autoload/../python/ycm/client/event_notification.py", line 61, in Response
 15     self._cached_response = JsonFromFuture( self._response_future )
 16   File "/home/ksekera/.vim/bundle/YouCompleteMe/autoload/../python/ycm/client/base_request.py", line 183, in JsonFromFuture
 17     raise MakeServerException( response.json() )
 18 ServerError: ValueError: Still no compile flags, no completions yet.
  1 2017-08-11 05:20:12,893 - INFO - Received ready request
  2 2017-08-11 05:20:14,888 - INFO - Received event notification
  3 2017-08-11 05:20:14,894 - INFO - Received event notification
  4 2017-08-11 05:20:14,896 - INFO - Adding buffer identifiers for file: /home/ksekera/vpp/src/vnet/l2/l2_fib.c
  5 2017-08-11 05:20:16,893 - INFO - Received filetype completion available request
  6 2017-08-11 05:20:19,010 - INFO - Received event notification
  7 2017-08-11 05:20:19,026 - INFO - Received event notification
  8 2017-08-11 05:20:19,032 - INFO - Received event notification
  9 2017-08-11 05:20:19,033 - INFO - Adding buffer identifiers for file: /home/ksekera/vpp/src/vnet/ethernet/ethernet.h
 10 Traceback (most recent call last):
 11   File "/home/ksekera/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/bottle/bottle.py", line 862, in _handle
 12     return route.call(**args)
 13   File "/home/ksekera/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/bottle/bottle.py", line 1740, in wrapper
 14     rv = callback(*a, **ka)
 15   File "/home/ksekera/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/watchdog_plugin.py", line 108, in wrapper
 16     return callback( *args, **kwargs )
 17   File "/home/ksekera/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/hmac_plugin.py", line 70, in wrapper
 18     body = callback( *args, **kwargs )
 19   File "/home/ksekera/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/handlers.py", line 70, in EventNotification
 20     event_handler )( request_data )
 21   File "/home/ksekera/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/completers/cpp/clang_completer.py", line 325, in OnFileReadyToPar    se
 22     raise ValueError( NO_COMPILE_FLAGS_MESSAGE )
 23 ValueError: Still no compile flags, no completions yet.                                                                                         24 2017-08-11 05:20:23,668 - INFO - Received event notification
 25 2017-08-11 05:20:23,685 - INFO - Received event notification
 26 2017-08-11 05:20:23,692 - INFO - Received event notification
 27 2017-08-11 05:20:23,694 - INFO - Adding buffer identifiers for file: /home/ksekera/vpp/src/vnet/l2/l2_fib.c
 28 2017-08-11 05:21:19,417 - INFO - Received event notification
 29 2017-08-11 05:21:19,418 - INFO - Adding buffer identifiers for file: /home/ksekera/vpp/src/vnet/l2/l2_fib.c
 30 2017-08-11 05:21:25,326 - INFO - Received event notification
 31 2017-08-11 05:21:25,342 - INFO - Received event notification
 32 2017-08-11 05:21:25,348 - INFO - Received event notification
 34 Traceback (most recent call last):
 35   File "/home/ksekera/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/bottle/bottle.py", line 862, in _handle
 36     return route.call(**args)
 37   File "/home/ksekera/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/bottle/bottle.py", line 1740, in wrapper
 38     rv = callback(*a, **ka)
 39   File "/home/ksekera/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/watchdog_plugin.py", line 108, in wrapper
 40     return callback( *args, **kwargs )
 41   File "/home/ksekera/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/hmac_plugin.py", line 70, in wrapper
 42     body = callback( *args, **kwargs )
 43   File "/home/ksekera/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/handlers.py", line 70, in EventNotification
 44     event_handler )( request_data )
 45   File "/home/ksekera/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/completers/cpp/clang_completer.py", line 325, in OnFileReadyToPar    se
 46     raise ValueError( NO_COMPILE_FLAGS_MESSAGE )
 47 ValueError: Still no compile flags, no completions yet.
 48 2017-08-11 05:21:35,498 - INFO - Received event notification
 49 2017-08-11 05:21:37,984 - INFO - Received event notification
 50 2017-08-11 05:21:37,990 - INFO - Received event notification
 51 2017-08-11 05:21:37,992 - INFO - Adding buffer identifiers for file: /home/ksekera/vpp/src/vnet/l2/l2_fib.c
 52 2017-08-11 05:21:52,921 - INFO - Received debug info request
 53 2017-08-11 05:22:53,476 - INFO - Received debug info request
 54 2017-08-11 05:23:34,048 - INFO - Received debug info request
 55 2017-08-11 05:23:38,893 - INFO - Received debug info request
 56 2017-08-11 05:23:43,982 - INFO - Received event notification
 57 2017-08-11 05:24:13,566 - INFO - Received event notification
 58 2017-08-11 05:24:13,572 - INFO - Received event notification
 59 2017-08-11 05:24:13,573 - INFO - Adding buffer identifiers for file: /home/ksekera/vpp/src/vnet/l2/l2_fib.c
 60 2017-08-11 05:24:15,637 - INFO - Received debug info request

OS version, distribution, etc.

Distributor ID: Ubuntu Description: Ubuntu 16.04.3 LTS Release: 16.04 Codename: xenial

bstaletic commented 7 years ago

The problem here is that the compile_commands.json is not found by ycmd. Are you sure it's placed correctly?

On Fri, Aug 11, 2017 at 12:36 PM, klement notifications@github.com wrote:

Issue Prelude

Please complete these steps and check these boxes (by putting an x inside the brackets) before filing your issue:

I understand this is an open-source project staffed by volunteers and that any help I receive is a selfless, heartfelt gift of their free time. I know I am not entitled to anything and will be polite and courteous.

I understand my issue may be closed if it becomes obvious I didn't actually perform all of these steps.

Thank you for adhering to this process! It ensures your issue is resolved quickly and that neither your nor our time is needlessly wasted. Issue Details

YCM shows errors in headers which don't occur during real compilation.

I'm using 'bear' tool to create compile_commands.json, which is then used by YCM - YcmDebugInfo shows that the compilation database is used, and that the correct compile command is picked from the database.

Now when I perform the compilation - either using gcc or clang, I get the same set of errors, ALL of which are located in a .c file.

The issue is that when I let YCM populate the location list, there are additional errors reported in an included header file, which has a ton of

ifdefs, so it's perfectly possible that it's not cleanly-compilable by

default. See below - the errors in ethernet.h and ip6_packet.h are not reported by gcc nor clang...

I couldn't create a minimalistic test case... Diagnostic data compile_commands.json entry:

1308 "command": "cc -c -DPACKAGE_NAME=\\"vpp\\" -DPACKAGE_TARNAME=\\"vpp\\" -DPACKAGE_VERSION=\\"17.10\\" -DPACKAGE_STRING=\\"vpp 17.10\\" -DPACKAGE_BUGREPORT=\\"vpp-dev@fd.io\\" -DPACKAGE_URL=\\"\\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STATH=1 -DHAVE STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 - DLT_OBJDIR=\\".libs/\\" -DPACKAGE=\\"vpp\\" -DVERSION=\\"17.10\\" -DDPDK_SHARED_LIB=0 -DWITH_LIBSSL=1 -I/home/ksekera/vpp/build-root/b uild-vpp_debug-native/vpp -I/home/ksekera/vpp/src -I/home/ksekera/vpp/build-root/install-vpp_debug-native/dpdk/include/dpdk -I/usr/include/d pdk -Wall -g -O0 -DCLIB_DEBUG -DFORTIFY_SOURCE=2 -march=corei7 -fstack-protector-all -fPIC -Werror -fPIC -DPIC -o vnet/l2/.libs/l2_fib.o /ho me/ksekera/vpp/src/vnet/l2/l2_fib.c", 1309 "directory": "/home/ksekera/vpp/build-root/build-vpp_debug-native/vpp", 1310 "file": "/home/ksekera/vpp/src/vnet/l2/l2_fib.c"

gcc errors while compiling the file

In file included from /home/ksekera/vpp/src/vppinfra/cuckoo_8_8.h:98:0, from /home/ksekera/vpp/src/vnet/l2/l2_fib.c:19: /home/ksekera/vpp/src/vnet/l2/l2_fib.c: In function ‘l2fib_table_dump’: /home/ksekera/vpp/src/vnet/l2/l2_fib.c:82:8: error: unknown type name ‘clib_cuckoo_value_8_8_t’ CVT (clib_cuckoo_value) * v; ^ /home/ksekera/vpp/src/vppinfra/cuckoo_template.h:83:21: note: in expansion of macro ‘_cvt’

define __cvt(a, b) _cvt (a, b)

                 ^

/home/ksekera/vpp/src/vppinfra/cuckoo_template.h:84:16: note: in expansion of macro ‘__cvt’

define CVT(a) __cvt (a, CLIB_CUCKOO_TYPE)

            ^

/home/ksekera/vpp/src/vnet/l2/l2_fib.c:82:3: note: in expansion of macro ‘CVT’ CVT (clib_cuckoo_value) * v; ^ /home/ksekera/vpp/src/vnet/l2/l2_fib.c:87:20: error: ‘clib_cuckoo_8_8_t {aka struct clib_cuckoo_8_8}’ has no member named ‘nbuckets’ for (i = 0; i < h->nbuckets; i++) ^ /home/ksekera/vpp/src/vnet/l2/l2_fib.c:90:12: error: ‘clib_cuckoo_bucket_8_8_t {aka struct }’ has no member named ‘offset’ if (b->offset == 0) ^ In file included from /home/ksekera/vpp/src/vppinfra/cuckoo_8_8.h:98:0, from /home/ksekera/vpp/src/vnet/l2/l2_fib.c:19: /home/ksekera/vpp/src/vnet/l2/l2_fib.c:92:15: error: implicit declaration of function ‘clib_cuckoo_get_value_8_8’ [-Werror=implicit-function-declaration] v = CV (clib_cuckoo_get_value) (h, b->offset); ^ /home/ksekera/vpp/src/vppinfra/cuckoo_template.h:78:19: note: in definition of macro ‘_cv’

define _cv(a, b) a##b

               ^

/home/ksekera/vpp/src/vppinfra/cuckoo_template.h:80:15: note: in expansion of macro ‘__cv’

define CV(a) __cv (a, CLIB_CUCKOO_TYPE)

           ^

/home/ksekera/vpp/src/vnet/l2/l2_fib.c:92:11: note: in expansion of macro ‘CV’ v = CV (clib_cuckoo_get_value) (h, b->offset); ^ /home/ksekera/vpp/src/vnet/l2/l2_fib.c:92:43: error: ‘clib_cuckoo_bucket_8_8_t {aka struct }’ has no member named ‘offset’ v = CV (clib_cuckoo_get_value) (h, b->offset); ^ /home/ksekera/vpp/src/vnet/l2/l2_fib.c:93:30: error: ‘clib_cuckoo_bucket_8_8_t {aka struct }’ has no member named ‘log2_pages’ for (j = 0; j < (1 << b->log2_pages); j++) ^ /home/ksekera/vpp/src/vnet/l2/l2_fib.c:97:13: error: request for member ‘kvp’ in something not a structure or union if (v->kvp[k].key == ~0ULL && v->kvp[k].value == ~0ULL) ^ /home/ksekera/vpp/src/vnet/l2/l2_fib.c:97:39: error: request for member ‘kvp’ in something not a structure or union if (v->kvp[k].key == ~0ULL && v->kvp[k].value == ~0ULL) ^ /home/ksekera/vpp/src/vnet/l2/l2_fib.c:100:19: error: request for member ‘kvp’ in something not a structure or union key.raw = v->kvp[k].key; ^ /home/ksekera/vpp/src/vnet/l2/l2_fib.c:101:22: error: request for member ‘kvp’ in something not a structure or union result.raw = v->kvp[k].value; ^ In file included from /home/ksekera/vpp/src/vppinfra/cuckoo_8_8.h:98:0, from /home/ksekera/vpp/src/vnet/l2/l2_fib.c:19: /home/ksekera/vpp/src/vnet/l2/l2_fib.c: In function ‘show_l2fib’: /home/ksekera/vpp/src/vnet/l2/l2_fib.c:124:8: error: unknown type name ‘clib_cuckoo_value_8_8_t’ CVT (clib_cuckoo_value) * v; ^ /home/ksekera/vpp/src/vppinfra/cuckoo_template.h:82:20: note: in definition of macro ‘_cvt’

define _cvt(a, b) a##b##_t

                ^

/home/ksekera/vpp/src/vppinfra/cuckoo_template.h:84:16: note: in expansion of macro ‘__cvt’

define CVT(a) __cvt (a, CLIB_CUCKOO_TYPE)

            ^

/home/ksekera/vpp/src/vnet/l2/l2_fib.c:124:3: note: in expansion of macro ‘CVT’ CVT (clib_cuckoo_value) * v; ^ /home/ksekera/vpp/src/vnet/l2/l2_fib.c:164:20: error: ‘clib_cuckoo_8_8_t {aka struct clib_cuckoo_8_8}’ has no member named ‘nbuckets’ for (i = 0; i < h->nbuckets; i++) ^ /home/ksekera/vpp/src/vnet/l2/l2_fib.c:167:12: error: ‘clib_cuckoo_bucket_8_8_t {aka struct }’ has no member named ‘offset’ if (b->offset == 0) ^ /home/ksekera/vpp/src/vnet/l2/l2_fib.c:169:43: error: ‘clib_cuckoo_bucket_8_8_t {aka struct }’ has no member named ‘offset’ v = CV (clib_cuckoo_get_value) (h, b->offset); ^ /home/ksekera/vpp/src/vnet/l2/l2_fib.c:170:30: error: ‘clib_cuckoo_bucket_8_8_t {aka struct }’ has no member named ‘log2_pages’ for (j = 0; j < (1 << b->log2_pages); j++) ^ /home/ksekera/vpp/src/vnet/l2/l2_fib.c:174:13: error: request for member ‘kvp’ in something not a structure or union if (v->kvp[k].key == ~0ULL && v->kvp[k].value == ~0ULL) ^ /home/ksekera/vpp/src/vnet/l2/l2_fib.c:174:39: error: request for member ‘kvp’ in something not a structure or union if (v->kvp[k].key == ~0ULL && v->kvp[k].value == ~0ULL) ^ /home/ksekera/vpp/src/vnet/l2/l2_fib.c:187:19: error: request for member ‘kvp’ in something not a structure or union key.raw = v->kvp[k].key; ^ /home/ksekera/vpp/src/vnet/l2/l2_fib.c:188:22: error: request for member ‘kvp’ in something not a structure or union result.raw = v->kvp[k].value; ^ In file included from /home/ksekera/vpp/src/vnet/l2/l2_fib.c:29:0: /home/ksekera/vpp/src/vnet/l2/l2_fib.c: In function ‘l2fib_clear_table’: /home/ksekera/vpp/src/vnet/l2/l2_fib.h:28:27: error: passing argument 4 of ‘clib_cuckoo_init_8_8’ makes pointer from integer without a cast [-Werror=int-conversion]

define L2FIB_MEMORY_SIZE (256<<20)

                       ^

/home/ksekera/vpp/src/vnet/l2/l2_fib.c:295:24: note: in expansion of macro ‘L2FIB_MEMORY_SIZE’ L2FIB_NUM_BUCKETS, L2FIB_MEMORY_SIZE); ^ In file included from /home/ksekera/vpp/src/vppinfra/cuckoo_8_8.h:98:0, from /home/ksekera/vpp/src/vnet/l2/l2_fib.c:19: /home/ksekera/vpp/src/vppinfra/cuckoo_template.c:161:10: note: expected ‘void ()(clib_cuckoo_8_8_t , void ) {aka void ()(struct clib_cuckoo_8_8 , void )}’ but argument is of type ‘int’ void CV (clib_cuckoo_init) ( ^ /home/ksekera/vpp/src/vppinfra/cuckoo_template.h:78:19: note: in definition of macro ‘_cv’

define _cv(a, b) a##b

               ^

/home/ksekera/vpp/src/vppinfra/cuckoo_template.h:80:15: note: in expansion of macro ‘__cv’

define CV(a) __cv (a, CLIB_CUCKOO_TYPE)

           ^

/home/ksekera/vpp/src/vppinfra/cuckoo_template.c:161:6: note: in expansion of macro ‘CV’ void CV (clib_cuckoo_init) ( ^ /home/ksekera/vpp/src/vnet/l2/l2_fib.c:294:7: error: too few arguments to function ‘clib_cuckoo_init_8_8’ CV (clib_cuckoo_init) (&mp->mac_table, "l2fib mac table", ^ /home/ksekera/vpp/src/vppinfra/cuckoo_template.h:78:19: note: in definition of macro ‘_cv’

define _cv(a, b) a##b

               ^

/home/ksekera/vpp/src/vppinfra/cuckoo_template.h:80:15: note: in expansion of macro ‘__cv’

define CV(a) __cv (a, CLIB_CUCKOO_TYPE)

           ^

/home/ksekera/vpp/src/vnet/l2/l2_fib.c:294:3: note: in expansion of macro ‘CV’ CV (clib_cuckoo_init) (&mp->mac_table, "l2fib mac table", ^ /home/ksekera/vpp/src/vppinfra/cuckoo_template.c:161:10: note: declared here void CV (clib_cuckoo_init) ( ^ /home/ksekera/vpp/src/vppinfra/cuckoo_template.h:78:19: note: in definition of macro ‘_cv’

define _cv(a, b) a##b

               ^

/home/ksekera/vpp/src/vppinfra/cuckoo_template.h:80:15: note: in expansion of macro ‘__cv’

define CV(a) __cv (a, CLIB_CUCKOO_TYPE)

           ^

/home/ksekera/vpp/src/vppinfra/cuckoo_template.c:161:6: note: in expansion of macro ‘CV’ void CV (clib_cuckoo_init) ( ^ /home/ksekera/vpp/src/vnet/l2/l2_fib.c: In function ‘l2fib_scan’: /home/ksekera/vpp/src/vnet/l2/l2_fib.c:982:20: error: ‘clib_cuckoo_8_8_t {aka struct clib_cuckoo_8_8}’ has no member named ‘nbuckets’ for (i = 0; i < h->nbuckets; i++) ^ /home/ksekera/vpp/src/vnet/l2/l2_fib.c:993:17: error: ‘clib_cuckoo_8_8_t {aka struct clib_cuckoo_8_8}’ has no member named ‘nbuckets’ if (i < (h->nbuckets - 3)) ^ /home/ksekera/vpp/src/vnet/l2/l2_fib.c:998:9: error: ‘clib_cuckoo_bucket_8_8_t {aka struct }’ has no member named ‘offset’ if (b->offset) ^ In file included from /home/ksekera/vpp/src/vppinfra/cuckoo_8_8.h:98:0, from /home/ksekera/vpp/src/vnet/l2/l2_fib.c:19: /home/ksekera/vpp/src/vnet/l2/l2_fib.c:1000:13: error: unknown type name ‘clib_cuckoo_value_8_8_t’ CVT (clib_cuckoo_value) * v = ^ /home/ksekera/vpp/src/vppinfra/cuckoo_template.h:82:20: note: in definition of macro ‘_cvt’

define _cvt(a, b) a##b##_t

                ^

/home/ksekera/vpp/src/vppinfra/cuckoo_template.h:84:16: note: in expansion of macro ‘__cvt’

define CVT(a) __cvt (a, CLIB_CUCKOO_TYPE)

            ^

/home/ksekera/vpp/src/vnet/l2/l2_fib.c:1000:8: note: in expansion of macro ‘CVT’ CVT (clib_cuckoo_value) v = ^ /home/ksekera/vpp/src/vnet/l2/l2_fib.c:1001:35: error: ‘clib_cuckoo_bucket_8_8_t {aka struct }’ has no member named ‘offset’ CV (clib_cuckoo_get_value) (h, b->offset); ^ /home/ksekera/vpp/src/vnet/l2/l2_fib.c:1007:12: error: ‘clib_cuckoo_bucket_8_8_t {aka struct }’ has no member named ‘offset’ if (b->offset == 0) ^ In file included from /home/ksekera/vpp/src/vppinfra/cuckoo_8_8.h:98:0, from /home/ksekera/vpp/src/vnet/l2/l2_fib.c:19: /home/ksekera/vpp/src/vnet/l2/l2_fib.c:1009:12: error: unknown type name ‘clib_cuckoo_value_8_8_t’ CVT (clib_cuckoo_value) v = CV (clib_cuckoo_get_value) (h, b->offset); ^ /home/ksekera/vpp/src/vppinfra/cuckoo_template.h:82:20: note: in definition of macro ‘_cvt’

define _cvt(a, b) a##b##_t

                ^

/home/ksekera/vpp/src/vppinfra/cuckoo_template.h:84:16: note: in expansion of macro ‘__cvt’

define CVT(a) __cvt (a, CLIB_CUCKOO_TYPE)

            ^

/home/ksekera/vpp/src/vnet/l2/l2_fib.c:1009:7: note: in expansion of macro ‘CVT’ CVT (clib_cuckoo_value) v = CV (clib_cuckoo_get_value) (h, b->offset); ^ /home/ksekera/vpp/src/vnet/l2/l2_fib.c:1009:69: error: ‘clib_cuckoo_bucket_8_8_t {aka struct }’ has no member named ‘offset’ CVT (clib_cuckoo_value) v = CV (clib_cuckoo_get_value) (h, b->offset); ^ /home/ksekera/vpp/src/vnet/l2/l2_fib.c:1010:30: error: ‘clib_cuckoo_bucket_8_8_t {aka struct }’ has no member named ‘log2_pages’ for (j = 0; j < (1 << b->log2_pages); j++) ^ /home/ksekera/vpp/src/vnet/l2/l2_fib.c:1014:13: error: request for member ‘kvp’ in something not a structure or union if (v->kvp[k].key == ~0ULL && v->kvp[k].value == ~0ULL) ^ /home/ksekera/vpp/src/vnet/l2/l2_fib.c:1014:39: error: request for member ‘kvp’ in something not a structure or union if (v->kvp[k].key == ~0ULL && v->kvp[k].value == ~0ULL) ^ /home/ksekera/vpp/src/vnet/l2/l2_fib.c:1017:41: error: request for member ‘kvp’ in something not a structure or union l2fib_entry_key_t key = {.raw = v->kvp[k].key }; ^ /home/ksekera/vpp/src/vnet/l2/l2_fib.c:1018:47: error: request for member ‘kvp’ in something not a structure or union l2fib_entry_result_t result = {.raw = v->kvp[k].value }; ^ In file included from /home/ksekera/vpp/src/vnet/l2/l2_fib.c:29:0: /home/ksekera/vpp/src/vnet/l2/l2_fib.c: In function ‘l2fib_init’: /home/ksekera/vpp/src/vnet/l2/l2_fib.h:28:27: error: passing argument 4 of ‘clib_cuckoo_init_8_8’ makes pointer from integer without a cast [-Werror=int-conversion]

define L2FIB_MEMORY_SIZE (256<<20)

                       ^

/home/ksekera/vpp/src/vnet/l2/l2_fib.c:1237:24: note: in expansion of macro ‘L2FIB_MEMORY_SIZE’ L2FIB_NUM_BUCKETS, L2FIB_MEMORY_SIZE); ^ In file included from /home/ksekera/vpp/src/vppinfra/cuckoo_8_8.h:98:0, from /home/ksekera/vpp/src/vnet/l2/l2_fib.c:19: /home/ksekera/vpp/src/vppinfra/cuckoo_template.c:161:10: note: expected ‘void ()(clib_cuckoo_8_8_t , void ) {aka void ()(struct clib_cuckoo_8_8 , void )}’ but argument is of type ‘int’ void CV (clib_cuckoo_init) ( ^ /home/ksekera/vpp/src/vppinfra/cuckoo_template.h:78:19: note: in definition of macro ‘_cv’

define _cv(a, b) a##b

               ^

/home/ksekera/vpp/src/vppinfra/cuckoo_template.h:80:15: note: in expansion of macro ‘__cv’

define CV(a) __cv (a, CLIB_CUCKOO_TYPE)

           ^

/home/ksekera/vpp/src/vppinfra/cuckoo_template.c:161:6: note: in expansion of macro ‘CV’ void CV (clib_cuckoo_init) ( ^ /home/ksekera/vpp/src/vnet/l2/l2_fib.c:1236:7: error: too few arguments to function ‘clib_cuckoo_init_8_8’ CV (clib_cuckoo_init) (&mp->mac_table, "l2fib mac table", ^ /home/ksekera/vpp/src/vppinfra/cuckoo_template.h:78:19: note: in definition of macro ‘_cv’

define _cv(a, b) a##b

               ^

/home/ksekera/vpp/src/vppinfra/cuckoo_template.h:80:15: note: in expansion of macro ‘__cv’

define CV(a) __cv (a, CLIB_CUCKOO_TYPE)

           ^

/home/ksekera/vpp/src/vnet/l2/l2_fib.c:1236:3: note: in expansion of macro ‘CV’ CV (clib_cuckoo_init) (&mp->mac_table, "l2fib mac table", ^ /home/ksekera/vpp/src/vppinfra/cuckoo_template.c:161:10: note: declared here void CV (clib_cuckoo_init) ( ^ /home/ksekera/vpp/src/vppinfra/cuckoo_template.h:78:19: note: in definition of macro ‘_cv’

define _cv(a, b) a##b

               ^

/home/ksekera/vpp/src/vppinfra/cuckoo_template.h:80:15: note: in expansion of macro ‘__cv’

define CV(a) __cv (a, CLIB_CUCKOO_TYPE)

           ^

/home/ksekera/vpp/src/vppinfra/cuckoo_template.c:161:6: note: in expansion of macro ‘CV’ void CV (clib_cuckoo_init) ( ^ cc1: all warnings being treated as errors

clang errors while compiling the file

/home/ksekera/vpp/src/vnet/l2/l2_fib.c:82:3: error: use of undeclared identifier 'clib_cuckoo_value_8_8_t' CVT (clib_cuckoo_value) * v; ^ /home/ksekera/vpp/src/vppinfra/cuckoo_template.h:84:16: note: expanded from macro 'CVT'

define CVT(a) __cvt (a, CLIB_CUCKOO_TYPE)

           ^

/home/ksekera/vpp/src/vppinfra/cuckoo_template.h:83:21: note: expanded from macro '__cvt'

define __cvt(a, b) _cvt (a, b)

                ^

/home/ksekera/vpp/src/vppinfra/cuckoo_template.h:82:20: note: expanded from macro '_cvt'

define _cvt(a, b) a##b##_t

               ^
:190:1: note: expanded from here clib_cuckoo_value_8_8_t ^ /home/ksekera/vpp/src/vnet/l2/l2_fib.c:82:29: error: use of undeclared identifier 'v' CVT (clib_cuckoo_value) * v; ^ /home/ksekera/vpp/src/vnet/l2/l2_fib.c:87:22: error: no member named 'nbuckets' in 'struct clib_cuckoo_8_8'; did you mean 'buckets'? for (i = 0; i < h->nbuckets; i++) ^~~~~~~~ buckets /home/ksekera/vpp/src/vppinfra/cuckoo_template.h:244:39: note: 'buckets' declared here _Atomic(CVT (clib_cuckoo_bucket) *) buckets; ^ /home/ksekera/vpp/src/vnet/l2/l2_fib.c:87:17: error: ordered comparison between pointer and integer ('int' and 'clib_cuckoo_bucket_8_8_t *') [-Werror] for (i = 0; i < h->nbuckets; i++) ~ ^ ~~~~~~~~~~~ /home/ksekera/vpp/src/vnet/l2/l2_fib.c:90:14: error: no member named 'offset' in 'clib_cuckoo_bucket_8_8_t' if (b->offset == 0) ~ ^ /home/ksekera/vpp/src/vnet/l2/l2_fib.c:92:7: error: use of undeclared identifier 'v' v = CV (clib_cuckoo_get_value) (h, b->offset); ^ /home/ksekera/vpp/src/vnet/l2/l2_fib.c:92:11: error: implicit declaration of function 'clib_cuckoo_get_value_8_8' is invalid in C99 [-Werror,-Wimplicit-function-declaration] v = CV (clib_cuckoo_get_value) (h, b->offset); ^ /home/ksekera/vpp/src/vppinfra/cuckoo_template.h:80:15: note: expanded from macro 'CV' #define CV(a) __cv (a, CLIB_CUCKOO_TYPE) ^ /home/ksekera/vpp/src/vppinfra/cuckoo_template.h:79:20: note: expanded from macro '__cv' #define __cv(a, b) _cv (a, b) ^ /home/ksekera/vpp/src/vppinfra/cuckoo_template.h:78:19: note: expanded from macro '_cv' #define _cv(a, b) a##b ^ :190:1: note: expanded from here clib_cuckoo_get_value_8_8 ^ /home/ksekera/vpp/src/vnet/l2/l2_fib.c:92:11: note: did you mean 'clib_cuckoo_set_elt_8_8'? /home/ksekera/vpp/src/vppinfra/cuckoo_template.h:80:15: note: expanded from macro 'CV' #define CV(a) __cv (a, CLIB_CUCKOO_TYPE) ^ /home/ksekera/vpp/src/vppinfra/cuckoo_template.h:79:20: note: expanded from macro '__cv' #define __cv(a, b) _cv (a, b) ^ /home/ksekera/vpp/src/vppinfra/cuckoo_template.h:78:19: note: expanded from macro '_cv' #define _cv(a, b) a##b ^ :190:1: note: expanded from here clib_cuckoo_get_value_8_8 ^ /home/ksekera/vpp/src/vppinfra/cuckoo_template.c:549:13: note: 'clib_cuckoo_set_elt_8_8' declared here static void CV (clib_cuckoo_set_elt) (CVT (clib_cuckoo_bucket) * b, ^ /home/ksekera/vpp/src/vppinfra/cuckoo_template.h:80:15: note: expanded from macro 'CV' #define CV(a) __cv (a, CLIB_CUCKOO_TYPE) ^ /home/ksekera/vpp/src/vppinfra/cuckoo_template.h:79:20: note: expanded from macro '__cv' #define __cv(a, b) _cv (a, b) ^ /home/ksekera/vpp/src/vppinfra/cuckoo_template.h:78:19: note: expanded from macro '_cv' #define _cv(a, b) a##b ^ :116:1: note: expanded from here clib_cuckoo_set_elt_8_8 ^ /home/ksekera/vpp/src/vnet/l2/l2_fib.c:92:45: error: no member named 'offset' in 'clib_cuckoo_bucket_8_8_t' v = CV (clib_cuckoo_get_value) (h, b->offset); ~ ^ /home/ksekera/vpp/src/vnet/l2/l2_fib.c:93:32: error: no member named 'log2_pages' in 'clib_cuckoo_bucket_8_8_t' for (j = 0; j < (1 << b->log2_pages); j++) ~ ^ /home/ksekera/vpp/src/vnet/l2/l2_fib.c:97:12: error: use of undeclared identifier 'v' if (v->kvp[k].key == ~0ULL && v->kvp[k].value == ~0ULL) ^ /home/ksekera/vpp/src/vnet/l2/l2_fib.c:97:38: error: use of undeclared identifier 'v' if (v->kvp[k].key == ~0ULL && v->kvp[k].value == ~0ULL) ^ /home/ksekera/vpp/src/vnet/l2/l2_fib.c:100:18: error: use of undeclared identifier 'v' key.raw = v->kvp[k].key; ^ /home/ksekera/vpp/src/vnet/l2/l2_fib.c:101:21: error: use of undeclared identifier 'v' result.raw = v->kvp[k].value; ^ /home/ksekera/vpp/src/vnet/l2/l2_fib.c:109:4: error: use of undeclared identifier 'v' v++; ^ /home/ksekera/vpp/src/vnet/l2/l2_fib.c:124:3: error: use of undeclared identifier 'clib_cuckoo_value_8_8_t' CVT (clib_cuckoo_value) * v; ^ /home/ksekera/vpp/src/vppinfra/cuckoo_template.h:84:16: note: expanded from macro 'CVT' #define CVT(a) __cvt (a, CLIB_CUCKOO_TYPE) ^ /home/ksekera/vpp/src/vppinfra/cuckoo_template.h:83:21: note: expanded from macro '__cvt' #define __cvt(a, b) _cvt (a, b) ^ /home/ksekera/vpp/src/vppinfra/cuckoo_template.h:82:20: note: expanded from macro '_cvt' #define _cvt(a, b) a##b##_t ^ :190:1: note: expanded from here clib_cuckoo_value_8_8_t ^ /home/ksekera/vpp/src/vnet/l2/l2_fib.c:124:29: error: use of undeclared identifier 'v' CVT (clib_cuckoo_value) * v; ^ /home/ksekera/vpp/src/vnet/l2/l2_fib.c:164:22: error: no member named 'nbuckets' in 'struct clib_cuckoo_8_8'; did you mean 'buckets'? for (i = 0; i < h->nbuckets; i++) ^~~~~~~~ buckets /home/ksekera/vpp/src/vppinfra/cuckoo_template.h:244:39: note: 'buckets' declared here _Atomic(CVT (clib_cuckoo_bucket) *) buckets; ^ /home/ksekera/vpp/src/vnet/l2/l2_fib.c:164:17: error: ordered comparison between pointer and integer ('int' and 'clib_cuckoo_bucket_8_8_t *') [-Werror] for (i = 0; i < h->nbuckets; i++) ~ ^ ~~~~~~~~~~~ /home/ksekera/vpp/src/vnet/l2/l2_fib.c:167:14: error: no member named 'offset' in 'clib_cuckoo_bucket_8_8_t' if (b->offset == 0) ~ ^ fatal error: too many errors emitted, stopping now [-ferror-limit=] 20 errors generated. location list contents in vim 1 src/vnet/l2/l2_fib.c [c,utf-8,unix] ⬥ ok cCommentStart 42,0x2A 16,2 0% 1 src/vnet/ethernet/ethernet.h|68 col 49 error| implicit conversion from 'int' to 'short' changes value from 33024 to -32512 2 src/vnet/ethernet/ethernet.h|69 col 7 error| implicit conversion from 'int' to 'short' changes value from 34984 to -30552 3 src/vnet/ethernet/ethernet.h|70 col 7 error| implicit conversion from 'int' to 'short' changes value from 37120 to -28416 4 src/vnet/ethernet/ethernet.h|71 col 7 error| implicit conversion from 'int' to 'short' changes value from 37376 to -28160 5 src/vnet/ethernet/ethernet.h|74 col 7 error| implicit conversion from 'int' to 'short' changes value from 37376 to -28160 6 src/vnet/ethernet/ethernet.h|75 col 7 error| implicit conversion from 'int' to 'short' changes value from 37376 to -28160 7 src/vnet/ethernet/ethernet.h|76 col 7 error| implicit conversion from 'int' to 'short' changes value from 37376 to -28160 8 src/vnet/ethernet/ethernet.h|77 col 7 error| implicit conversion from 'int' to 'short' changes value from 37376 to -28160 9 src/vnet/ip/ip6_packet.h|153 col 63 error| taking address of packed member '' of class or structure 'ip46_address_t' may result in an unaligned pointer value 10 src/vnet/ip/ip6_packet.h|154 col 32 error| taking address of packed member 'ip6' of class or structure 'ip46_address_t' may result in an unalig ned pointer value 11 src/vnet/l2/l2_fib.c|4 col 24 error| missing terminating '"' character 12 src/vnet/l2/l2_fib.c|82 col 3 error| use of undeclared identifier 'clib_cuckoo_value_8_8_t' 13 src/vnet/l2/l2_fib.c|82 col 29 error| use of undeclared identifier 'v' 14 src/vnet/l2/l2_fib.c|87 col 22 error| no member named 'nbuckets' in 'struct clib_cuckoo_8_8' 15 src/vnet/l2/l2_fib.c|90 col 14 error| no member named 'offset' in 'clib_cuckoo_bucket_8_8_t' 16 src/vnet/l2/l2_fib.c|92 col 7 error| use of undeclared identifier 'v' 17 src/vnet/l2/l2_fib.c|92 col 11 error| implicit declaration of function 'clib_cuckoo_get_value_8_8' is invalid in C99 (FixIt available) 18 src/vnet/l2/l2_fib.c|92 col 45 error| no member named 'offset' in 'clib_cuckoo_bucket_8_8_t' 19 src/vnet/l2/l2_fib.c|93 col 32 error| no member named 'log2_pages' in 'clib_cuckoo_bucket_8_8_t' 20 src/vnet/l2/l2_fib.c|97 col 12 error| use of undeclared identifier 'v' 21 src/vnet/l2/l2_fib.c|97 col 38 error| use of undeclared identifier 'v' 22 src/vnet/l2/l2_fib.c|100 col 18 error| use of undeclared identifier 'v' 23 src/vnet/l2/l2_fib.c|101 col 21 error| use of undeclared identifier 'v' 24 src/vnet/l2/l2_fib.c|109 col 4 error| use of undeclared identifier 'v' 25 src/vnet/l2/l2_fib.c|124 col 3 error| use of undeclared identifier 'clib_cuckoo_value_8_8_t' 26 src/vnet/l2/l2_fib.c|124 col 29 error| use of undeclared identifier 'v' 27 src/vnet/l2/l2_fib.c|164 col 22 error| no member named 'nbuckets' in 'struct clib_cuckoo_8_8' 28 src/vnet/l2/l2_fib.c|167 col 14 error| no member named 'offset' in 'clib_cuckoo_bucket_8_8_t' 29 src/vnet/l2/l2_fib.c|169 col 7 error| use of undeclared identifier 'v' [Location List] :setloclist() 1,1 All Diagnostics refreshed Output of vim --version VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Feb 21 2017 03:50:47) Included patches: 1-329 Compiled by ksekera@zglab-host-4 Huge version without GUI. Features included (+) or not (-): +acl +file_in_path +mouse_sgr +tag_old_static +arabic +find_in_path -mouse_sysmouse -tag_any_white +autocmd +float +mouse_urxvt -tcl -balloon_eval +folding +mouse_xterm +termguicolors -browse -footer +multi_byte +terminfo ++builtin_terms +fork() +multi_lang +termresponse +byte_offset +gettext -mzscheme +textobjects +channel -hangul_input +netbeans_intg +timers +cindent +iconv +num64 +title -clientserver +insert_expand +packages -toolbar -clipboard +job +path_extra +user_commands +cmdline_compl +jumplist -perl +vertsplit +cmdline_hist +keymap +persistent_undo +virtualedit +cmdline_info +lambda +postscript +visual +comments +langmap +printer +visualextra +conceal +libcall +profile +viminfo +cryptv +linebreak +python +vreplace +cscope +lispindent -python3 +wildignore +cursorbind +listcmds +quickfix +wildmenu +cursorshape +localmap +reltime +windows +dialog_con -lua +rightleft +writebackup +diff +menu -ruby -X11 +digraphs +mksession +scrollbind -xfontset -dnd +modify_fname +signs -xim -ebcdic +mouse +smartindent -xpm +emacs_tags -mouseshape +startuptime -xsmp +eval +mouse_dec +statusline -xterm_clipboard +ex_extra -mouse_gpm -sun_workshop -xterm_save +extra_search -mouse_jsbterm +syntax +farsi +mouse_netterm +tag_binary system vimrc file: "$VIM/vimrc" user vimrc file: "$HOME/.vimrc" 2nd user vimrc file: "~/.vim/vimrc" user exrc file: "$HOME/.exrc" defaults file: "$VIMRUNTIME/defaults.vim" fall-back for $VIM: "/home/ksekera/share/vim" Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 Linking: gcc -L/usr/local/lib -Wl,--as-needed -o vim -lm -ltinfo -lnsl -ldl -L/usr/lib/python2.7/ -lpython2.7 Output of YcmDebugInfo Printing YouCompleteMe debug information... -- Client logfile: /tmp/ycm_Fo2HnV.log -- Server Python interpreter: /usr/bin/python -- Server Python version: 2.7.12 -- Server has Clang support compiled in: True -- Clang version: clang version 4.0.1 (tags/RELEASE_401/final) -- No extra configuration file found -- C-family completer debug information: -- Compilation database path: /home/ksekera -- Flags: ['cc', '-DPACKAGE_NAME="vpp"', '-DPACKAGE_TARNAME="vpp"', '-DPACKAGE_VERSION="17.10"', '-DPACKAGE_STRING="vpp', '17.10"', '-DPACKAGE_BU GREPORT="vpp-dev@fd.io"', '-DPACKAGE_URL=""', '-DSTDC_HEADERS=1', '-DHAVE_SYS_TYPES_H=1', '-DHAVE_SYS_STAT_H=1', '-DHAVE_STDLIB_H=1', '-DHAVE_STRIN G_H=1', '-DHAVE_MEMORY_H=1', '-DHAVE_STRINGS_H=1', '-DHAVE_INTTYPES_H=1', '-DHAVE_STDINT_H=1', '-DHAVE_UNISTD_H=1', '-DHAVE_DLFCN_H=1', '-DLT_OBJDI R=".libs/"', '-DPACKAGE="vpp"', '-DVERSION="17.10"', '-DDPDK_SHARED_LIB=0', '-DWITH_LIBSSL=1', '-I/home/ksekera/vpp/build-root/build-vpp_debug-nati ve/vpp', '-I/home/ksekera/vpp/src', '-I/home/ksekera/vpp/build-root/install-vpp_debug-native/dpdk/include/dpdk', '-I/usr/include/dpdk', '-Wall', '- g', '-O0', '-DCLIB_DEBUG', '-DFORTIFY_SOURCE=2', '-march=corei7', '-fstack-protector-all', '-fPIC', '-Werror', '-fPIC', '-DPIC', '-resource-dir=/ho me/ksekera/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../clang_includes', '-fspell-checking'] -- Server running at: http://127.0.0.1:46232 -- Server process ID: 10855 -- Server logfiles: -- /tmp/ycmd_46232_stdout_XqIQLS.log -- /tmp/ycmd_46232_stderr_bKFAxQ.log Contents of YCM, ycmd and completion engine logfiles 1 2017-08-11 05:20:19,137 - ERROR - Error while handling server response 2 Traceback (most recent call last): 3 File "/home/ksekera/.vim/bundle/YouCompleteMe/autoload/../python/ycm/client/base_request.py", line 214, in HandleServerException 4 yield 5 File "/home/ksekera/.vim/bundle/YouCompleteMe/autoload/../python/ycm/client/event_notification.py", line 61, in Response 6 self._cached_response = JsonFromFuture( self._response_future ) 7 File "/home/ksekera/.vim/bundle/YouCompleteMe/autoload/../python/ycm/client/base_request.py", line 183, in JsonFromFuture 8 raise MakeServerException( response.json() ) 9 ServerError: ValueError: Still no compile flags, no completions yet. 10 2017-08-11 05:21:25,447 - ERROR - Error while handling server response 11 Traceback (most recent call last): 12 File "/home/ksekera/.vim/bundle/YouCompleteMe/autoload/../python/ycm/client/base_request.py", line 214, in HandleServerException 13 yield 14 File "/home/ksekera/.vim/bundle/YouCompleteMe/autoload/../python/ycm/client/event_notification.py", line 61, in Response 15 self._cached_response = JsonFromFuture( self._response_future ) 16 File "/home/ksekera/.vim/bundle/YouCompleteMe/autoload/../python/ycm/client/base_request.py", line 183, in JsonFromFuture 17 raise MakeServerException( response.json() ) 18 ServerError: ValueError: Still no compile flags, no completions yet. 1 2017-08-11 05:20:12,893 - INFO - Received ready request 2 2017-08-11 05:20:14,888 - INFO - Received event notification 3 2017-08-11 05:20:14,894 - INFO - Received event notification 4 2017-08-11 05:20:14,896 - INFO - Adding buffer identifiers for file: /home/ksekera/vpp/src/vnet/l2/l2_fib.c 5 2017-08-11 05:20:16,893 - INFO - Received filetype completion available request 6 2017-08-11 05:20:19,010 - INFO - Received event notification 7 2017-08-11 05:20:19,026 - INFO - Received event notification 8 2017-08-11 05:20:19,032 - INFO - Received event notification 9 2017-08-11 05:20:19,033 - INFO - Adding buffer identifiers for file: /home/ksekera/vpp/src/vnet/ethernet/ethernet.h 10 Traceback (most recent call last): 11 File "/home/ksekera/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/bottle/bottle.py", line 862, in _handle 12 return route.call(**args) 13 File "/home/ksekera/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/bottle/bottle.py", line 1740, in wrapper 14 rv = callback(*a, **ka) 15 File "/home/ksekera/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/watchdog_plugin.py", line 108, in wrapper 16 return callback( *args, **kwargs ) 17 File "/home/ksekera/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/hmac_plugin.py", line 70, in wrapper 18 body = callback( *args, **kwargs ) 19 File "/home/ksekera/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/handlers.py", line 70, in EventNotification 20 event_handler )( request_data ) 21 File "/home/ksekera/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/completers/cpp/clang_completer.py", line 325, in OnFileReadyToPar se 22 raise ValueError( NO_COMPILE_FLAGS_MESSAGE ) 23 ValueError: Still no compile flags, no completions yet. 24 2017-08-11 05:20:23,668 - INFO - Received event notification 25 2017-08-11 05:20:23,685 - INFO - Received event notification 26 2017-08-11 05:20:23,692 - INFO - Received event notification 27 2017-08-11 05:20:23,694 - INFO - Adding buffer identifiers for file: /home/ksekera/vpp/src/vnet/l2/l2_fib.c 28 2017-08-11 05:21:19,417 - INFO - Received event notification 29 2017-08-11 05:21:19,418 - INFO - Adding buffer identifiers for file: /home/ksekera/vpp/src/vnet/l2/l2_fib.c 30 2017-08-11 05:21:25,326 - INFO - Received event notification 31 2017-08-11 05:21:25,342 - INFO - Received event notification 32 2017-08-11 05:21:25,348 - INFO - Received event notification 34 Traceback (most recent call last): 35 File "/home/ksekera/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/bottle/bottle.py", line 862, in _handle 36 return route.call(**args) 37 File "/home/ksekera/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/bottle/bottle.py", line 1740, in wrapper 38 rv = callback(*a, **ka) 39 File "/home/ksekera/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/watchdog_plugin.py", line 108, in wrapper 40 return callback( *args, **kwargs ) 41 File "/home/ksekera/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/hmac_plugin.py", line 70, in wrapper 42 body = callback( *args, **kwargs ) 43 File "/home/ksekera/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/handlers.py", line 70, in EventNotification 44 event_handler )( request_data ) 45 File "/home/ksekera/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/completers/cpp/clang_completer.py", line 325, in OnFileReadyToPar se 46 raise ValueError( NO_COMPILE_FLAGS_MESSAGE ) 47 ValueError: Still no compile flags, no completions yet. 48 2017-08-11 05:21:35,498 - INFO - Received event notification 49 2017-08-11 05:21:37,984 - INFO - Received event notification 50 2017-08-11 05:21:37,990 - INFO - Received event notification 51 2017-08-11 05:21:37,992 - INFO - Adding buffer identifiers for file: /home/ksekera/vpp/src/vnet/l2/l2_fib.c 52 2017-08-11 05:21:52,921 - INFO - Received debug info request 53 2017-08-11 05:22:53,476 - INFO - Received debug info request 54 2017-08-11 05:23:34,048 - INFO - Received debug info request 55 2017-08-11 05:23:38,893 - INFO - Received debug info request 56 2017-08-11 05:23:43,982 - INFO - Received event notification 57 2017-08-11 05:24:13,566 - INFO - Received event notification 58 2017-08-11 05:24:13,572 - INFO - Received event notification 59 2017-08-11 05:24:13,573 - INFO - Adding buffer identifiers for file: /home/ksekera/vpp/src/vnet/l2/l2_fib.c 60 2017-08-11 05:24:15,637 - INFO - Received debug info request OS version, distribution, etc. Distributor ID: Ubuntu Description: Ubuntu 16.04.3 LTS Release: 16.04 Codename: xenial — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub , or mute the thread .
klement commented 7 years ago

How so?

Looking at YcmDebugInfo:

-- C-family completer debug information:
--   Compilation database path: /home/ksekera
--   Flags: ['cc', '-DPACKAGE_NAME="vpp"', '-DPACKAGE_TARNAME="vpp"', '-DPACKAGE_VERSION="17.10"', '-DPACKAGE_STRING="vpp', '17.10"', '-DPACKAGE_BU
GREPORT="vpp-dev@fd.io"', '-DPACKAGE_URL=""', '-DSTDC_HEADERS=1', '-DHAVE_SYS_TYPES_H=1', '-DHAVE_SYS_STAT_H=1', '-DHAVE_STDLIB_H=1', '-DHAVE_STRIN
G_H=1', '-DHAVE_MEMORY_H=1', '-DHAVE_STRINGS_H=1', '-DHAVE_INTTYPES_H=1', '-DHAVE_STDINT_H=1', '-DHAVE_UNISTD_H=1', '-DHAVE_DLFCN_H=1', '-DLT_OBJDI
R=".libs/"', '-DPACKAGE="vpp"', '-DVERSION="17.10"', '-DDPDK_SHARED_LIB=0', '-DWITH_LIBSSL=1', '-I/home/ksekera/vpp/build-root/build-vpp_debug-nati
ve/vpp', '-I/home/ksekera/vpp/src', '-I/home/ksekera/vpp/build-root/install-vpp_debug-native/dpdk/include/dpdk', '-I/usr/include/dpdk', '-Wall', '-
g', '-O0', '-DCLIB_DEBUG', '-DFORTIFY_SOURCE=2', '-march=corei7', '-fstack-protector-all', '-fPIC', '-Werror', '-fPIC', '-DPIC', '-resource-dir=/ho
me/ksekera/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../clang_includes', '-fspell-checking']
-- Server running at: http://127.0.0.1:46232
-- Server process ID: 10855

where do the flags come from then if not from compile_commands.json?

compilation database is here: /home/ksekera/compile_commands.json

I just tried moving it to project root (/home/ksekera/vpp) and the behavior is the same, only the path changes in YcmDebugInfo output:

Printing YouCompleteMe debug information...
-- Client logfile: /tmp/ycm_XeK8aR.log
-- Server Python interpreter: /usr/bin/python
-- Server Python version: 2.7.12
-- Server has Clang support compiled in: True
-- Clang version: clang version 4.0.1 (tags/RELEASE_401/final)
-- No extra configuration file found
-- C-family completer debug information:
--   Compilation database path: /home/ksekera/vpp
--   Flags: ['cc', '-DPACKAGE_NAME="vpp"', '-DPACKAGE_TARNAME="vpp"', '-DPACKAGE_VERSION="17.10"', '-DPACKAGE_STRING="vpp', '17.10"', '-DPACKAGE_BU
GREPORT="vpp-dev@fd.io"', '-DPACKAGE_URL=""', '-DSTDC_HEADERS=1', '-DHAVE_SYS_TYPES_H=1', '-DHAVE_SYS_STAT_H=1', '-DHAVE_STDLIB_H=1', '-DHAVE_STRIN
G_H=1', '-DHAVE_MEMORY_H=1', '-DHAVE_STRINGS_H=1', '-DHAVE_INTTYPES_H=1', '-DHAVE_STDINT_H=1', '-DHAVE_UNISTD_H=1', '-DHAVE_DLFCN_H=1', '-DLT_OBJDI
R=".libs/"', '-DPACKAGE="vpp"', '-DVERSION="17.10"', '-DDPDK_SHARED_LIB=0', '-DWITH_LIBSSL=1', '-I/home/ksekera/vpp/build-root/build-vpp_debug-nati
ve/vpp', '-I/home/ksekera/vpp/src', '-I/home/ksekera/vpp/build-root/install-vpp_debug-native/dpdk/include/dpdk', '-I/usr/include/dpdk', '-Wall', '-
g', '-O0', '-DCLIB_DEBUG', '-DFORTIFY_SOURCE=2', '-march=corei7', '-fstack-protector-all', '-fPIC', '-Werror', '-fPIC', '-DPIC', '-resource-dir=/ho
me/ksekera/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../clang_includes', '-fspell-checking']
-- Server running at: http://127.0.0.1:37042
-- Server process ID: 6104
-- Server logfiles:
--   /tmp/ycmd_37042_stdout_6edW5M.log
--   /tmp/ycmd_37042_stderr_uJuDdO.log
bstaletic commented 7 years ago

Okay, I misread something (No extra configuration file found). But your logs do say "no flags". I am at work, so can't check now.

micbou commented 7 years ago

@klement Could you try again with the latest version of YCM? You'll have to rebuild it with Clang support:

./install.py --clang-completer
klement commented 7 years ago

I updated YCM and rebuilt the binary, no change...

I'm trying this today on pristine VPP code, so if you'd like to try it out on your own, here are the steps to repro:

~> mkdir vpp-ycm
~> cd vpp-ycm
~/vpp-ycm> git clone https://gerrit.fd.io/r/vpp
...
~/vpp-ycm> cd vpp
~/v/vpp> bear make CCACHE_DIR=/home/ksekera/.ccache build
...

this doesn't print any errors or warnings, to verify, re-run the build command for affected file:

~/v/vpp> grep l2_fib.c compile_commands.json
        "command": "cc -c -DPACKAGE_NAME=\\\"vpp\\\" -DPACKAGE_TARNAME=\\\"vpp\\\" -DPACKAGE_VERSION=\\\"17.10\\\" -DPACKAGE_STRING=\\\"vpp 17.10\\\" -DPACKAGE_BUGREPORT=\\\"vpp-dev@fd.io\\\" -DPACKAGE_URL=\\\"\\\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\\\".libs/\\\" -DPACKAGE=\\\"vpp\\\" -DVERSION=\\\"17.10\\\" -DDPDK_SHARED_LIB=0 -DWITH_LIBSSL=1 -I/home/ksekera/vpp-ycm/vpp/build-root/build-vpp_debug-native/vpp -I/home/ksekera/vpp-ycm/vpp/src -I/home/ksekera/vpp-ycm/vpp/build-root/install-vpp_debug-native/dpdk/include/dpdk -I/usr/include/dpdk -Wall -g -O0 -DCLIB_DEBUG -DFORTIFY_SOURCE=2 -march=corei7 -fstack-protector-all -fPIC -Werror -fPIC -DPIC -o vnet/l2/.libs/l2_fib.o /home/ksekera/vpp-ycm/vpp/src/vnet/l2/l2_fib.c",
        "file": "/home/ksekera/vpp-ycm/vpp/src/vnet/l2/l2_fib.c"
        "command": "cc -c -DPACKAGE_NAME=\\\"vpp\\\" -DPACKAGE_TARNAME=\\\"vpp\\\" -DPACKAGE_VERSION=\\\"17.10\\\" -DPACKAGE_STRING=\\\"vpp 17.10\\\" -DPACKAGE_BUGREPORT=\\\"vpp-dev@fd.io\\\" -DPACKAGE_URL=\\\"\\\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\\\".libs/\\\" -DPACKAGE=\\\"vpp\\\" -DVERSION=\\\"17.10\\\" -DDPDK_SHARED_LIB=0 -DWITH_LIBSSL=1 -I/home/ksekera/vpp-ycm/vpp/build-root/build-vpp_debug-native/vpp -I/home/ksekera/vpp-ycm/vpp/src -I/home/ksekera/vpp-ycm/vpp/build-root/install-vpp_debug-native/dpdk/include/dpdk -I/usr/include/dpdk -Wall -g -O0 -DCLIB_DEBUG -DFORTIFY_SOURCE=2 -march=corei7 -fstack-protector-all -fPIC -Werror -o vnet/l2/l2_fib.o /home/ksekera/vpp-ycm/vpp/src/vnet/l2/l2_fib.c",
        "file": "/home/ksekera/vpp-ycm/vpp/src/vnet/l2/l2_fib.c"
~/v/vpp> cd build-root/build-vpp_debug-native/vpp
~/v/v/b/b/vpp> cc -c -DPACKAGE_NAME="vpp" -DPACKAGE_TARNAME="vpp" -DPACKAGE_VERSION="17.10" -DPACKAGE_STRING="vpp 17.10" -DPACKAGE_BUGREPORT="vpp-dev@fd.io" -DPACKAGE_URL="" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=".libs/" -DPACKAGE="vpp" -DVERSION="17.10" -DDPDK_SHARED_LIB=0 -DWITH_LIBSSL=1 -I/home/ksekera/vpp-ycm/vpp/build-root/build-vpp_debug-native/vpp -I/home/ksekera/vpp-ycm/vpp/src -I/home/ksekera/vpp-ycm/vpp/build-root/install-vpp_debug-native/dpdk/include/dpdk -I/usr/include/dpdk -Wall -g -O0 -DCLIB_DEBUG -DFORTIFY_SOURCE=2 -march=corei7 -fstack-protector-all -fPIC -Werror -fPIC -DPIC -o vnet/l2/.libs/l2_fib.o /home/ksekera/vpp-ycm/vpp/src/vnet/l2/l2_fib.c
~/v/v/b/b/vpp>

The 2nd commands yields similar result - no errors/warnings.

Now in VIM we see the issue:

1   src/vnet/l2/l2_fib.c [c,utf-8,unix]     ⬥ ok                                                          cComment 42,0x2A       4,2             0%
1 /home/ksekera/vpp-ycm/vpp/src/vnet/ethernet/ethernet.h|68 col 49 error| implicit conversion from 'int' to 'short' changes value from 33024 to -
2 /home/ksekera/vpp-ycm/vpp/src/vnet/ethernet/ethernet.h|69 col 7 error| implicit conversion from 'int' to 'short' changes value from 34984 to -3    0552
3 /home/ksekera/vpp-ycm/vpp/src/vnet/ethernet/ethernet.h|70 col 7 error| implicit conversion from 'int' to 'short' changes value from 37120 to -2    8416
4 /home/ksekera/vpp-ycm/vpp/src/vnet/ethernet/ethernet.h|71 col 7 error| implicit conversion from 'int' to 'short' changes value from 37376 to -2    8160
5 /home/ksekera/vpp-ycm/vpp/src/vnet/ethernet/ethernet.h|74 col 7 error| implicit conversion from 'int' to 'short' changes value from 37376 to -2    8160
6 /home/ksekera/vpp-ycm/vpp/src/vnet/ethernet/ethernet.h|75 col 7 error| implicit conversion from 'int' to 'short' changes value from 37376 to -2    8160
7 /home/ksekera/vpp-ycm/vpp/src/vnet/ethernet/ethernet.h|76 col 7 error| implicit conversion from 'int' to 'short' changes value from 37376 to -2    8160
8 /home/ksekera/vpp-ycm/vpp/src/vnet/ethernet/ethernet.h|77 col 7 error| implicit conversion from 'int' to 'short' changes value from 37376 to -2    8160
9 /home/ksekera/vpp-ycm/vpp/src/vnet/ip/ip6_packet.h|153 col 63 error| taking address of packed member '' of class or structure 'ip46_address_t'     may result in an unaligned pointer value
10 /home/ksekera/vpp-ycm/vpp/src/vnet/ip/ip6_packet.h|154 col 32 error| taking address of packed member 'ip6' of class or structure 'ip46_address_    t' may result in an unaligned pointer value
 11 src/vnet/l2/l2_fib.c|4 col 24 error| missing terminating '"' character
[Location List] :setloclist()                                                                                                   1,1             All
Diagnostics refreshed
klement commented 7 years ago

Looking at https://git.fd.io/vpp/tree/src/vnet/l2/l2_fib.c you can see that the last error is completely wrong - it points inside a comment-block, which is the first thing present in the file with no #include statements preceding it. I don't see how the "missing terminating '"' character" could be reported for a comment block...

puremourning commented 7 years ago

Does it compile under clang 5 with the same build command ?

klement commented 7 years ago

wow, it seems not...

it compiles perfectly fine on ubuntu 16.04 with clang 3.8.0

~/v/b/b/vpp> clang -c -DPACKAGE_NAME="vpp" -DPACKAGE_TARNAME="vpp" -DPACKAGE_VERSION="17.10" -DPACKAGE_STRING="vpp 17.10" -DPA
CKAGE_BUGREPORT="vpp-dev@fd.io" -DPACKAGE_URL="" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHA
VE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=".libs/" -DPACKAGE="vpp" -DVE
RSION="17.10" -DDPDK_SHARED_LIB=0 -DWITH_LIBSSL=1 -I/home/ksekera/vpp-ycm/vpp/build-root/build-vpp_debug-native/vpp -I/home/ksekera/vpp-ycm/vpp/src -I/home/ksekera/vpp-ycm/vpp/build-root/install-vpp_debug-native/dpdk/include/dpdk -I/usr/include/dpdk -Wall -g -O0 -DCLIB_DEBUG -DFORTIFY_SOURCE=2 -march=corei7 -fstack-protector-all -fPIC -Werror -fPIC -DPIC -o vnet/l2/.libs/l2_fib.o /home/ksekera/vpp-ycm/vpp/src/vnet/l2/l2_fib.c
~/v/b/b/vpp> clang -v                                                                                                         clang version 3.8.0-2ubuntu4 (tags/RELEASE_380/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/6.0.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.4.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.0.0                                                                              Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0                                                                              Candidate multilib: .;@m64
Selected multilib: .;@m64

but not on arch with clang 5...

 ~/v/v/b/b/vpp> clang -c -DPACKAGE_NAME="vpp" -DPACKAGE_TARNAME="vpp" -DPACKAGE_VERSION="17.10" -DPACKAGE_STRING="vpp 17.10" -D
PACKAGE_BUGREPORT="vpp-dev@fd.io" -DPACKAGE_URL="" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -D
HAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=".libs/" -DPACKAGE="vpp" -D
VERSION="17.10" -DDPDK_SHARED_LIB=0 -DWITH_LIBSSL=1 -I/home/ksekera/vpp-ycm/vpp/build-root/build-vpp_debug-native/vpp -I/home/ksekera/vpp-ycm/vpp/s
rc -I/home/ksekera/vpp-ycm/vpp/build-root/install-vpp_debug-native/dpdk/include/dpdk -I/usr/include/dpdk -Wall -g -O0 -DCLIB_DEBUG -DFORTIFY_SOURCE
=2 -march=corei7 -fstack-protector-all -fPIC -Werror -fPIC -DPIC -o vnet/l2/.libs/l2_fib.o /home/ksekera/vpp-ycm/vpp/src/vnet/l2/l2_fib.c
In file included from /home/ksekera/vpp-ycm/vpp/src/vnet/l2/l2_fib.c:22:
/home/ksekera/vpp-ycm/vpp/src/vnet/ethernet/ethernet.h:68:49: error: implicit conversion from 'int' to 'short' changes value from 33024 to -32512
      [-Werror,-Wconstant-conversion]
  const __m128i ethertype_mask = _mm_set_epi16 (ETHERNET_TYPE_VLAN,
                                 ~~~~~~~~~~~~~  ^~~~~~~~~~~~~~~~~~
/home/ksekera/vpp-ycm/vpp/src/vnet/ethernet/ethernet.h:69:7: error: implicit conversion from 'int' to 'short' changes value from 34984 to -30552
      [-Werror,-Wconstant-conversion]
                                                ETHERNET_TYPE_DOT1AD,
                                                ^~~~~~~~~~~~~~~~~~~~
/home/ksekera/vpp-ycm/vpp/src/vnet/ethernet/ethernet.h:70:7: error: implicit conversion from 'int' to 'short' changes value from 37120 to -28416
      [-Werror,-Wconstant-conversion]
                                                ETHERNET_TYPE_VLAN_9100,
                                                ^~~~~~~~~~~~~~~~~~~~~~~
/home/ksekera/vpp-ycm/vpp/src/vnet/ethernet/ethernet.h:71:7: error: implicit conversion from 'int' to 'short' changes value from 37376 to -28160
      [-Werror,-Wconstant-conversion]
                                                ETHERNET_TYPE_VLAN_9200,
                                                ^~~~~~~~~~~~~~~~~~~~~~~
/home/ksekera/vpp-ycm/vpp/src/vnet/ethernet/ethernet.h:74:7: error: implicit conversion from 'int' to 'short' changes value from 37376 to -28160
      [-Werror,-Wconstant-conversion]
                                                ETHERNET_TYPE_VLAN_9200,
                                                ^~~~~~~~~~~~~~~~~~~~~~~
/home/ksekera/vpp-ycm/vpp/src/vnet/ethernet/ethernet.h:75:7: error: implicit conversion from 'int' to 'short' changes value from 37376 to -28160
      [-Werror,-Wconstant-conversion]
                                                ETHERNET_TYPE_VLAN_9200,
                                                ^~~~~~~~~~~~~~~~~~~~~~~
/home/ksekera/vpp-ycm/vpp/src/vnet/ethernet/ethernet.h:76:7: error: implicit conversion from 'int' to 'short' changes value from 37376 to -28160
      [-Werror,-Wconstant-conversion]
                                                ETHERNET_TYPE_VLAN_9200,
                                                ^~~~~~~~~~~~~~~~~~~~~~~
/home/ksekera/vpp-ycm/vpp/src/vnet/ethernet/ethernet.h:77:7: error: implicit conversion from 'int' to 'short' changes value from 37376 to -28160
      [-Werror,-Wconstant-conversion]
                                                ETHERNET_TYPE_VLAN_9200);
                                                ^~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/ksekera/vpp-ycm/vpp/src/vnet/l2/l2_fib.c:27:
In file included from /home/ksekera/vpp-ycm/vpp/src/vnet/l2/l2_input.h:25:
In file included from /home/ksekera/vpp-ycm/vpp/src/vnet/ip/ip.h:51:
In file included from /home/ksekera/vpp-ycm/vpp/src/vnet/ip/lookup.h:54:
/home/ksekera/vpp-ycm/vpp/src/vnet/ip/ip6_packet.h:153:63: error: taking address of packed member '' of class or structure 'ip46_address_t' may
      result in an unaligned pointer value [-Werror,-Waddress-of-packed-member]
  return ip46_address_is_ip4 (a) ? ip4_address_is_multicast (&a->ip4) :
                                                              ^~~~~~
/home/ksekera/vpp-ycm/vpp/src/vnet/ip/ip6_packet.h:154:32: error: taking address of packed member 'ip6' of class or structure 'ip46_address_t' may
      result in an unaligned pointer value [-Werror,-Waddress-of-packed-member]
    ip6_address_is_multicast (&a->ip6);
                               ^~~~~~
10 errors generated.
~/v/v/b/b/vpp> clang -v
clang version 5.0.0 (tags/RELEASE_500/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-pc-linux-gnu/7.2.0
Found candidate GCC installation: /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/7.2.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0
Found candidate GCC installation: /usr/lib64/gcc/x86_64-pc-linux-gnu/7.2.0
Selected GCC installation: /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/7.2.0
Candidate multilib: .;@m64
Selected multilib: .;@m64
klement commented 7 years ago

Reopening the issue because fixing clang warnings fixed only some of the warnings - I added -Wno-constant-conversion and -Wno-address-of-packed-member, which now makes the file to compile cleanly under clang 5:

ksekera@ksekera-arch ~/v/b/b/vpp> clang -v
clang version 5.0.0 (tags/RELEASE_500/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-pc-linux-gnu/7.2.0
Found candidate GCC installation: /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/7.2.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0
Found candidate GCC installation: /usr/lib64/gcc/x86_64-pc-linux-gnu/7.2.0
Selected GCC installation: /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/7.2.0
Candidate multilib: .;@m64
Selected multilib: .;@m64
ksekera@ksekera-arch ~/v/b/b/vpp> clang -c -DPACKAGE_NAME="vpp" -DPACKAGE_TARNAME="vpp" -DPACKAGE_VERSION="17.10" -DPACKAGE_STRING="vpp 17.10" -DPA
CKAGE_BUGREPORT="vpp-dev@fd.io" -DPACKAGE_URL="" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHA
VE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=".libs/" -DPACKAGE="vpp" -DVE
RSION="17.10" -DDPDK_SHARED_LIB=0 -DWITH_LIBSSL=1 -I/home/ksekera/vpp/build-root/build-vpp_debug-native/vpp -I/home/ksekera/vpp/src -I/home/ksekera
/vpp/build-root/install-vpp_debug-native/dpdk/include/dpdk -I/usr/include/dpdk -Wall -g -O0 -DCLIB_DEBUG -DFORTIFY_SOURCE=2 -march=corei7 -fstack-p
rotector-all -fPIC -Werror -Wno-constant-conversion -Wno-address-of-packed-member -fPIC -DPIC -o vnet/ip/.libs/ip4_input.o /home/ksekera/vpp/src/vnet/ip/ip4_input.c

the problem is that there is still a false report in VIM...

1   src/vnet/ip/ip4_input.c [c,utf-8,unix]     ⬥ ok                                                  cCommentStart 47,0x2F       1,1            Top
  1 src/vnet/ip/ip4_input.c|4 col 24 error| missing terminating '"' character
[Location List] :setloclist()                                                                                                   1,1             All
Diagnostics refreshed

this can be seen in other files as well:

4   src/vnet/l2/l2_fib.c [c,utf-8,unix]     ⬥ ok                                                          cComment 32,0x20       3,1            Top
  1 /home/ksekera/vpp|4 col 24 error| missing terminating '"' character
[Location List] :setloclist()                                                                                                   1,1             All
Diagnostics refreshed

so I'm guessing it could be caused by a header, searching for the simplest header which shows the issue, it seems to be this one

src/vppinfra/types.h

17  src/vppinfra/types.h [c,utf-8,unix]     ⬥ ok                                                     cCommentStart 47,0x2F       1,1            Top
  1 /home/ksekera/vpp|4 col 24 error| missing terminating '"' character
[Location List] :setloclist()                                                                                                   1,1             All
Diagnostics refreshed

though it "compiles" cleanly...

ksekera@ksekera-arch ~/v/b/b/vpp> clang -c -DPACKAGE_NAME="vpp" -DPACKAGE_TARNAME="vpp" -DPACKAGE_VERSION="17.10" -DPACKAGE_STRING="vpp 17.10" -DPACKAGE_BUGREPORT="vpp-dev@fd.io" -DPACKAGE_URL="" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=".libs/" -DPACKAGE="vpp" -DVERSION="17.10" -DDPDK_SHARED_LIB=0 -DWITH_LIBSSL=1 -I/home/ksekera/vpp/build-root/build-vpp_debug-native/vpp -I/home/ksekera/vpp/src -I/home/ksekera/vpp/build-root/install-vpp_debug-native/dpdk/include/dpdk -I/usr/include/dpdk -Wall -g -O0 -DCLIB_DEBUG -DFORTIFY_SOURCE=2 -march=corei7 -fstack-protector-all -fPIC -Werror -Wno-constant-conversion -Wno-address-of-packed-member -fPIC -DPIC /home/ksekera/vpp/src/vppinfra/types.h
ksekera@ksekera-arch ~/v/b/b/vpp>
puremourning commented 7 years ago

It looks like Those errors are in your code so closing.

klement commented 7 years ago

Can you please explain?

The code compiles cleanly under gcc/clang3.8/clang5.

I'm pretty sure that there is no such error (missing terminating '"' character) as reported by YCM.

If you take a look at the affected file types.h you see that it begins with a big comment block - first 36 lines are 2 comment blocks. The error reported is on line 4. That surely can't be right.

klement commented 7 years ago

I played with it a bit more and reduced the case to:

~> cat compile_commands.json
[
    {
        "command": "cc -c -DPACKAGE_NAME=\\\"vpp \\\" -o a.o /home/ksekera/a.c",
        "directory": "/home/ksekera/",
        "file": "/home/ksekera/a.c"
    },
]
~> cat a.c
~>

yes, the source file is empty

the error disappears if the space in the -DPACKAGE_NAME is removed, which leads me to believe that the json file is wrongly generated by bear.

klement commented 7 years ago

yet another bump...it looks like the double-escaping is intentional because it is required ?

see this bear issue

could you please check the above compile_commands.json and tell whether its correct or not?

changing

-DPACKAGE_NAME=\\\"vpp \\\"

to

-DPACKAGE_NAME=\"vpp \"

removes the error which YCM reports, but looking at the above bear issue, it seems that it's intentional.

puremourning commented 7 years ago

It looks wrong to me. You wouldn’t pass the extra slashes to clang on the command line.

Try using a YCM extra conf file.

puremourning commented 7 years ago

That is unless the thing you are defining should contain the quotes also?

micbou commented 7 years ago

Looks like a Bear bug. The correct escaping should be

-DPACKAGE_NAME=\\\"vpp\\ \\\"

Escaping the space is needed. Otherwise, the above is understood as two separate flags -DPACKAGE_NAME="vpp and ".

pseyfert commented 5 years ago

ftr: just faced the same issue. -DPACKAGE_NAME=\\\"somename\\\" is afaiu how cmake generates compile_commands.json files. they work fine for me with llvm tools (iwyu, clang-tidy). we stumbled over it though when writing our own tiny tools in python that would process the json db. we couldn't just launch the commands as subprocess as they came from the parsed json, but instead is that we couldn't just launch a subprocess with what we got from the parsed json, but had to use subprocess.call( … shell=True) (where then the extra escapes are needed).

Anyway, thanks @klement for posting.