UPGW告警消除记录

告警日志和消除方法

下面是最开始编译代码的告警日志,在相同类型的告警日志下面附上了告警原因和对应的修改方法。

[root@upgw upgw]# make
== libs
== libnes_api
  CC libnes_api.o
/opt/upgw/libs/libnes_api/libnes_api.c:691:5: warning: no previous prototype for ‘nes_bypass_client’ [-Wmissing-prototypes]
 int nes_bypass_client(nes_remote_t *self, char *bypass_data_string)
     ^
/opt/upgw/libs/libnes_api/libnes_api.c:736:5: warning: no previous prototype for ‘nes_loglevel_set_client’ [-Wmissing-prototypes]
 int nes_loglevel_set_client(nes_remote_t *self, uint8_t loglevel)
     ^
/opt/upgw/libs/libnes_api/libnes_api.c:772:5: warning: no previous prototype for ‘nes_route_show_by_uuid’ [-Wmissing-prototypes]
 int nes_route_show_by_uuid(nes_remote_t *self, char *route_rule_uuid,
     ^
/opt/upgw/libs/libnes_api/libnes_api.c:964:5: warning: no previous prototype for ‘nes_domain_name_show’ [-Wmissing-prototypes]
 int nes_domain_name_show(nes_remote_t *self, struct nes_dns_data_s ** domain_name, uint16_t *domain_cnt, char *dns_rule_uuid)
     ^

1、/* warning: no previous prototype for ‘nes_bypass_client’ */
原因:该函数未声明。
修改方法:如果告警函数只在文件内部使用,在函数前面添加static即可消除告警;如果告警函数在其它文件被调用,则需在对应的.h文件中声明。此处因为其它文件有调用,所以选择第二种方式。

/opt/upgw/libs/libnes_api/libnes_api.c: In function ‘nes_domain_name_show’:
/opt/upgw/libs/libnes_api/libnes_api.c:978:20: warning: unused variable ‘ret’ [-Wunused-variable]
     enum NES_ERROR ret;
                    ^
2、/* warning: unused variable ‘ret’ */
原因:变量未被使用。
修改方法:删除该变量。

/opt/upgw/libs/libnes_api/libnes_api.c: At top level:
/opt/upgw/libs/libnes_api/libnes_api.c:1062:5: warning: no previous prototype for ‘nes_domain_name_update’ [-Wmissing-prototypes]
 int nes_domain_name_update(nes_remote_t *self, char *dns_rule_uuid, char *lookup_keys)
     ^
/opt/upgw/libs/libnes_api/libnes_api.c:1250:5: warning: no previous prototype for ‘nes_route_remove_by_uuid’ [-Wmissing-prototypes]
 int nes_route_remove_by_uuid(nes_remote_t *self, char *route_rule_uuid)
     ^
/opt/upgw/libs/libnes_api/libnes_api.c:1289:5: warning: no previous prototype for ‘nes_route_update’ [-Wmissing-prototypes]
 int nes_route_update(nes_remote_t *self, struct ether_addr vm_mac_addr,
     ^
/opt/upgw/libs/libnes_api/libnes_api.c:1298:5: warning: no previous prototype for ‘nes_route_remove_mirror_by_uuid’ [-Wmissing-prototypes]
 int nes_route_remove_mirror_by_uuid(nes_remote_t *self, char *route_rule_uuid)
     ^

3、/* warning: no previous prototype for ‘nes_domain_name_update’ */
原因:同1。
修改方法:在相应的头文件中声明。

  CC /opt/upgw//libs/libnes_sq/libnes_sq.o
  CC /opt/upgw//libs/libnes_cfgfile/libnes_cfgfile.o
  CC /opt/upgw//libs/libnes_routefile/libnes_routefile.o
/opt/upgw//libs/libnes_routefile/libnes_routefile.c: In function ‘nes_routefile_load’:
/opt/upgw//libs/libnes_routefile/libnes_routefile.c:91:19: warning: assignment from incompatible pointer type [enabled by default]
     nes_routefile = rte_cfgfile_load(filename, flags);
                   ^
/opt/upgw//libs/libnes_routefile/libnes_routefile.c: In function ‘nes_routefile_entry’:
/opt/upgw//libs/libnes_routefile/libnes_routefile.c:98:5: warning: passing argument 1 of ‘rte_cfgfile_get_entry’ from incompatible pointer type [enabled by default]
     *value = rte_cfgfile_get_entry(nes_routefile, section, entry);
     ^
In file included from /opt/upgw//libs/libnes_routefile/libnes_routefile.c:15:0:
/opt/dpdk-18.08/x86_64-native-linuxapp-gcc/include/rte_cfgfile.h:319:13: note: expected ‘struct rte_cfgfile *’ but argument is of type ‘struct rte_routefile *’
 const char *rte_cfgfile_get_entry(struct rte_cfgfile *cfg,
             ^
/opt/upgw//libs/libnes_routefile/libnes_routefile.c: In function ‘nes_routefile_has_section’:
/opt/upgw//libs/libnes_routefile/libnes_routefile.c:105:5: warning: passing argument 1 of ‘rte_cfgfile_has_section’ from incompatible pointer type [enabled by default]
     return 0 == rte_cfgfile_has_section(nes_routefile,section) ? NES_FAIL : NES_SUCCESS;
     ^
In file included from /opt/upgw//libs/libnes_routefile/libnes_routefile.c:15:0:
/opt/dpdk-18.08/x86_64-native-linuxapp-gcc/include/rte_cfgfile.h:215:5: note: expected ‘struct rte_cfgfile *’ but argument is of type ‘struct rte_routefile *’
 int rte_cfgfile_has_section(struct rte_cfgfile *cfg, const char *sectionname);
     ^
/opt/upgw//libs/libnes_routefile/libnes_routefile.c: In function ‘nes_routefile_get_entries’:
/opt/upgw//libs/libnes_routefile/libnes_routefile.c:112:5: warning: passing argument 1 of ‘rte_cfgfile_section_entries’ from incompatible pointer type [enabled by default]
     return rte_cfgfile_section_entries(nes_routefile, sectionname, entries, max_entries) > 0 ?
     ^
In file included from /opt/upgw//libs/libnes_routefile/libnes_routefile.c:15:0:
/opt/dpdk-18.08/x86_64-native-linuxapp-gcc/include/rte_cfgfile.h:271:5: note: expected ‘struct rte_cfgfile *’ but argument is of type ‘struct rte_routefile *’
 int rte_cfgfile_section_entries(struct rte_cfgfile *cfg,
     ^

4、/* warning: assignment from incompatible pointer type */
原因:参数类型不匹配,需要的类型是struct rte_cfgfile *,而传入的nes_routefile类型是struct rte_routefile *。
修改方法:struct rte_routefile和struct rte_cfgfile中定义的变量一致,将nes_routefile改为struct rte_cfgfile *类型。

/opt/upgw//libs/libnes_routefile/libnes_routefile.c: At top level:
/opt/upgw//libs/libnes_routefile/libnes_routefile.c:116:5: warning: no previous prototype for ‘nes_routefile_add_entry’ [-Wmissing-prototypes]
 int nes_routefile_add_entry(const char *sectionname, const char *entryname, const char *entryvalue)
     ^

5、/* warning: no previous prototype */
原因:同1。
修改方法:在相应的头文件中声明。

/opt/upgw//libs/libnes_routefile/libnes_routefile.c: In function ‘nes_routefile_add_entry’:
/opt/upgw//libs/libnes_routefile/libnes_routefile.c:119:5: warning: passing argument 1 of ‘rte_cfgfile_add_entry’ from incompatible pointer type [enabled by default]
     return rte_cfgfile_add_entry(nes_routefile, sectionname, entryname, entryvalue);
     ^
In file included from /opt/upgw//libs/libnes_routefile/libnes_routefile.c:15:0:
/opt/dpdk-18.08/x86_64-native-linuxapp-gcc/include/rte_cfgfile.h:137:5: note: expected ‘struct rte_cfgfile *’ but argument is of type ‘struct rte_routefile *’
 int rte_cfgfile_add_entry(struct rte_cfgfile *cfg,
     ^

6、/* warning: passing argument 1 of ‘rte_cfgfile_add_entry’ from incompatible pointer type */
原因:同4。
修改方法:同4。

/opt/upgw//libs/libnes_routefile/libnes_routefile.c: At top level:
/opt/upgw//libs/libnes_routefile/libnes_routefile.c:122:5: warning: no previous prototype for ‘nes_routefile_save’ [-Wmissing-prototypes]
 int nes_routefile_save(char *filename)
     ^

7、/* warning: no previous prototype */
原因:同1。
修改方法:在相应的头文件中声明。

/opt/upgw//libs/libnes_routefile/libnes_routefile.c: In function ‘nes_routefile_save’:
/opt/upgw//libs/libnes_routefile/libnes_routefile.c:127:5: warning: passing argument 1 of ‘rte_cfgfile_save’ from incompatible pointer type [enabled by default]
     return rte_cfgfile_save(nes_routefile, filename);
     ^
In file included from /opt/upgw//libs/libnes_routefile/libnes_routefile.c:15:0:
/opt/dpdk-18.08/x86_64-native-linuxapp-gcc/include/rte_cfgfile.h:168:5: note: expected ‘struct rte_cfgfile *’ but argument is of type ‘struct rte_routefile *’
 int rte_cfgfile_save(struct rte_cfgfile *cfg, const char *filename);
     ^

8、/* warning: passing argument 1 of ‘rte_cfgfile_save’ from incompatible pointer type */
原因:同4。
修改方法:同4。

/opt/upgw//libs/libnes_routefile/libnes_routefile.c: At top level:
/opt/upgw//libs/libnes_routefile/libnes_routefile.c:130:5: warning: no previous prototype for ‘nes_routefile_set_entry’ [-Wmissing-prototypes]
 int nes_routefile_set_entry(const char *sectionname, const char *entryname, const char *entryvalue)
     ^

9、/* no previous prototype for ‘nes_routefile_set_entry’ */
原因:同1。
修改方法:在相应的头文件中声明。

/opt/upgw//libs/libnes_routefile/libnes_routefile.c: In function ‘nes_routefile_set_entry’:
/opt/upgw//libs/libnes_routefile/libnes_routefile.c:133:5: warning: passing argument 1 of ‘rte_cfgfile_set_entry’ from incompatible pointer type [enabled by default]
     return rte_cfgfile_set_entry(nes_routefile, sectionname, entryname, entryvalue);
     ^
In file included from /opt/upgw//libs/libnes_routefile/libnes_routefile.c:15:0:
/opt/dpdk-18.08/x86_64-native-linuxapp-gcc/include/rte_cfgfile.h:155:5: note: expected ‘struct rte_cfgfile *’ but argument is of type ‘struct rte_routefile *’
 int rte_cfgfile_set_entry(struct rte_cfgfile *cfg, const char *sectionname,
     ^
/opt/upgw//libs/libnes_routefile/libnes_routefile.c: In function ‘nes_routefile_section_num_entries’:
/opt/upgw//libs/libnes_routefile/libnes_routefile.c:139:5: warning: passing argument 1 of ‘rte_cfgfile_section_num_entries’ from incompatible pointer type [enabled by default]
     return rte_cfgfile_section_num_entries(nes_routefile, sectionname);
     ^
In file included from /opt/upgw//libs/libnes_routefile/libnes_routefile.c:15:0:
/opt/dpdk-18.08/x86_64-native-linuxapp-gcc/include/rte_cfgfile.h:230:5: note: expected ‘struct rte_cfgfile *’ but argument is of type ‘struct rte_routefile *’
 int rte_cfgfile_section_num_entries(struct rte_cfgfile *cfg,
     ^
/opt/upgw//libs/libnes_routefile/libnes_routefile.c: In function ‘nes_routefile_close’:
/opt/upgw//libs/libnes_routefile/libnes_routefile.c:144:5: warning: passing argument 1 of ‘rte_cfgfile_close’ from incompatible pointer type [enabled by default]
     rte_cfgfile_close(nes_routefile);
     ^
In file included from /opt/upgw//libs/libnes_routefile/libnes_routefile.c:15:0:
/opt/dpdk-18.08/x86_64-native-linuxapp-gcc/include/rte_cfgfile.h:349:5: note: expected ‘struct rte_cfgfile *’ but argument is of type ‘struct rte_routefile *’
 int rte_cfgfile_close(struct rte_cfgfile *cfg);
     ^

10、/* warning: passing argument 1 of ‘rte_cfgfile_set_entry’ from incompatible pointer type */
原因:同4。
修改方法:同4。

/opt/upgw//libs/libnes_routefile/libnes_routefile.c: In function ‘nes_routefile_clear_deleted_entries’:
/opt/upgw//libs/libnes_routefile/libnes_routefile.c:67:14: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result [-Wunused-result]
         fgets(entry, 320, route_file);
              ^

11、/* ignoring return value of ‘fgets’, declared with attribute warn_unused_result */
原因:未对返回值处理。
修改方法:添加对返回值的判断:if (fgets(entry, 320, route_file) != NULL) {},如果无异常再进行后续的操作。

  CC /opt/upgw//libs/libnes_redis/libnes_redis.o
/opt/upgw//libs/libnes_redis/libnes_redis.c:17:7: warning: no previous prototype for ‘get_rule_key’ [-Wmissing-prototypes]
 char *get_rule_key(uint8_t type) {
       ^

12、/* warning: no previous prototype for ‘get_rule_key’ */
原因:同1。
修改方法:函数加static修饰。

/opt/upgw//libs/libnes_redis/libnes_redis.c: In function ‘get_rule_key’:
/opt/upgw//libs/libnes_redis/libnes_redis.c:20:13: warning: return discards ‘const’ qualifier from pointer target type [enabled by default]
             return "traffic_rules";
             ^
/opt/upgw//libs/libnes_redis/libnes_redis.c:22:13: warning: return discards ‘const’ qualifier from pointer target type [enabled by default]
             return "dns_rules";
             ^
/opt/upgw//libs/libnes_redis/libnes_redis.c:25:13: warning: return discards ‘const’ qualifier from pointer target type [enabled by default]
             return INVALID_RULE;
             ^

13、/* warning: return discards ‘const’ qualifier from pointer target type */
原因:函数实际的返回值与定义函数的返回值不一致。
修改方法:函数定义的返回值类型也加const修饰。

/opt/upgw//libs/libnes_redis/libnes_redis.c: At top level:
/opt/upgw//libs/libnes_redis/libnes_redis.c:29:15: warning: function declaration isn’t a prototype [-Wstrict-prototypes]
 redisContext *redis_connect() {
               ^
/opt/upgw//libs/libnes_redis/libnes_redis.c: In function ‘redis_connect’:
/opt/upgw//libs/libnes_redis/libnes_redis.c:29:15: warning: old-style function definition [-Wold-style-definition]

14、/* warning: function declaration isn’t a prototype */
/* warning: old-style function definition */
原因:函数未声明;函数没有参数。
修改方法:加static修饰;没有参数需加void。

/opt/upgw//libs/libnes_redis/libnes_redis.c: In function ‘sync_get_number_of_rule’:
/opt/upgw//libs/libnes_redis/libnes_redis.c:170:9: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘long long int’ [-Wformat=]
         NES_LOG(INFO, "Get number of %s: %d successfully.\n", rule_key, reply->integer);
         ^

15、/* warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘long long int’ */
原因:变量类型与打印形式不匹配。
修改方法:打印方法变为%lld。

/opt/upgw//libs/libnes_redis/libnes_redis.c: In function ‘sync_get_all_rule’:
/opt/upgw//libs/libnes_redis/libnes_redis.c:221:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for (i=0; i<count; i++) {
                    ^
/opt/upgw//libs/libnes_redis/libnes_redis.c:235:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for (i=0; i<count; i++) {
                    ^

16、/* warning: comparison between signed and unsigned integer expressions */
原因:有符号和无符号之间的比较,防止一个负的符号型数据转化为无符号型时,会产生一个不是我们想要的很大的数据。
修改方法:将i改为无符号类型。

/opt/upgw//libs/libnes_redis/libnes_redis.c: In function ‘sync_put_rule’:
/opt/upgw//libs/libnes_redis/libnes_redis.c:106:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
/opt/upgw//libs/libnes_redis/libnes_redis.c: In function ‘sync_get_one_rule’:
/opt/upgw//libs/libnes_redis/libnes_redis.c:147:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
/opt/upgw//libs/libnes_redis/libnes_redis.c: In function ‘sync_get_number_of_rule’:
/opt/upgw//libs/libnes_redis/libnes_redis.c:181:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
/opt/upgw//libs/libnes_redis/libnes_redis.c: In function ‘sync_del_rule’:
/opt/upgw//libs/libnes_redis/libnes_redis.c:291:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^

17、/* warning: control reaches end of non-void function */
原因:函数末尾没有给出返回值。
修改方法:在末尾添加return返回相应的结果。

  AR libnes_api.a
  INSTALL-LIB libnes_api.a
== libnes_cfgfile
  CC libnes_cfgfile.o
  AR libnes_cfgfile.a
  INSTALL-LIB libnes_cfgfile.a
== libnes_daemon
  CC libnes_daemon.o
  AR libnes_daemon.a
  INSTALL-LIB libnes_daemon.a
== libnes_lookup
  CC libnes_lookup.o
  AR libnes_lookup.a
  INSTALL-LIB libnes_lookup.a
== libnes_queue
  CC libnes_queue.o
  AR libnes_queue.a
  INSTALL-LIB libnes_queue.a
== libnes_sq
  CC libnes_sq.o
  AR libnes_sq.a
  INSTALL-LIB libnes_sq.a
== libnes_acl
  CC libnes_acl.o
  AR libnes_acl.a
  INSTALL-LIB libnes_acl.a
== libnes_api_shared
  CC libnes_api/libnes_api.o
/opt/upgw//libs/libnes_api/libnes_api.c:691:5: warning: no previous prototype for ‘nes_bypass_client’ [-Wmissing-prototypes]
 int nes_bypass_client(nes_remote_t *self, char *bypass_data_string)
     ^
/opt/upgw//libs/libnes_api/libnes_api.c:736:5: warning: no previous prototype for ‘nes_loglevel_set_client’ [-Wmissing-prototypes]
 int nes_loglevel_set_client(nes_remote_t *self, uint8_t loglevel)
     ^
/opt/upgw//libs/libnes_api/libnes_api.c:772:5: warning: no previous prototype for ‘nes_route_show_by_uuid’ [-Wmissing-prototypes]
 int nes_route_show_by_uuid(nes_remote_t *self, char *route_rule_uuid,
     ^
/opt/upgw//libs/libnes_api/libnes_api.c:964:5: warning: no previous prototype for ‘nes_domain_name_show’ [-Wmissing-prototypes]
 int nes_domain_name_show(nes_remote_t *self, struct nes_dns_data_s ** domain_name, uint16_t *domain_cnt, char *dns_rule_uuid)
     ^

18、/* warning: no previous prototype for ‘nes_bypass_client’ */
原因:同1。
修改方法:在相应的头文件中声明。

/opt/upgw//libs/libnes_api/libnes_api.c: In function ‘nes_domain_name_show’:
/opt/upgw//libs/libnes_api/libnes_api.c:978:20: warning: unused variable ‘ret’ [-Wunused-variable]
     enum NES_ERROR ret;
                    ^

19、/* warning: unused variable ‘ret’ */
原因:同2。
修改方法:同2。

/opt/upgw//libs/libnes_api/libnes_api.c: At top level:
/opt/upgw//libs/libnes_api/libnes_api.c:1062:5: warning: no previous prototype for ‘nes_domain_name_update’ [-Wmissing-prototypes]
 int nes_domain_name_update(nes_remote_t *self, char *dns_rule_uuid, char *lookup_keys)
     ^
/opt/upgw//libs/libnes_api/libnes_api.c:1250:5: warning: no previous prototype for ‘nes_route_remove_by_uuid’ [-Wmissing-prototypes]
 int nes_route_remove_by_uuid(nes_remote_t *self, char *route_rule_uuid)
     ^
/opt/upgw//libs/libnes_api/libnes_api.c:1289:5: warning: no previous prototype for ‘nes_route_update’ [-Wmissing-prototypes]
 int nes_route_update(nes_remote_t *self, struct ether_addr vm_mac_addr,
     ^
/opt/upgw//libs/libnes_api/libnes_api.c:1298:5: warning: no previous prototype for ‘nes_route_remove_mirror_by_uuid’ [-Wmissing-prototypes]
 int nes_route_remove_mirror_by_uuid(nes_remote_t *self, char *route_rule_uuid)
     ^

20、/* warning: no previous prototype for ‘nes_domain_name_update’ */
原因:同1。
修改方法:在相应的头文件中声明。

  CC libnes_sq/libnes_sq.o
  LD libnes_api_shared.so
  INSTALL-SHARED libnes_api_shared.so
/opt/upgw//build/lib must be added to /etc/ld.so.conf or LD_LIBRARY_PATH variable to allow binary to link with dynamic library
== libnes_routefile
  CC libnes_routefile.o
/opt/upgw/libs/libnes_routefile/libnes_routefile.c: In function ‘nes_routefile_load’:
/opt/upgw/libs/libnes_routefile/libnes_routefile.c:91:19: warning: assignment from incompatible pointer type [enabled by default]
     nes_routefile = rte_cfgfile_load(filename, flags);
                   ^
/opt/upgw/libs/libnes_routefile/libnes_routefile.c: In function ‘nes_routefile_entry’:
/opt/upgw/libs/libnes_routefile/libnes_routefile.c:98:5: warning: passing argument 1 of ‘rte_cfgfile_get_entry’ from incompatible pointer type [enabled by default]
     *value = rte_cfgfile_get_entry(nes_routefile, section, entry);
     ^
In file included from /opt/upgw/libs/libnes_routefile/libnes_routefile.c:15:0:
/opt/dpdk-18.08/x86_64-native-linuxapp-gcc/include/rte_cfgfile.h:319:13: note: expected ‘struct rte_cfgfile *’ but argument is of type ‘struct rte_routefile *’
 const char *rte_cfgfile_get_entry(struct rte_cfgfile *cfg,
             ^
/opt/upgw/libs/libnes_routefile/libnes_routefile.c: In function ‘nes_routefile_has_section’:
/opt/upgw/libs/libnes_routefile/libnes_routefile.c:105:5: warning: passing argument 1 of ‘rte_cfgfile_has_section’ from incompatible pointer type [enabled by default]
     return 0 == rte_cfgfile_has_section(nes_routefile,section) ? NES_FAIL : NES_SUCCESS;
     ^
In file included from /opt/upgw/libs/libnes_routefile/libnes_routefile.c:15:0:
/opt/dpdk-18.08/x86_64-native-linuxapp-gcc/include/rte_cfgfile.h:215:5: note: expected ‘struct rte_cfgfile *’ but argument is of type ‘struct rte_routefile *’
 int rte_cfgfile_has_section(struct rte_cfgfile *cfg, const char *sectionname);
     ^
/opt/upgw/libs/libnes_routefile/libnes_routefile.c: In function ‘nes_routefile_get_entries’:
/opt/upgw/libs/libnes_routefile/libnes_routefile.c:112:5: warning: passing argument 1 of ‘rte_cfgfile_section_entries’ from incompatible pointer type [enabled by default]
     return rte_cfgfile_section_entries(nes_routefile, sectionname, entries, max_entries) > 0 ?
     ^
In file included from /opt/upgw/libs/libnes_routefile/libnes_routefile.c:15:0:
/opt/dpdk-18.08/x86_64-native-linuxapp-gcc/include/rte_cfgfile.h:271:5: note: expected ‘struct rte_cfgfile *’ but argument is of type ‘struct rte_routefile *’
 int rte_cfgfile_section_entries(struct rte_cfgfile *cfg,
     ^

21、/* warning: assignment from incompatible pointer type */
原因:同4。
修改方法:同4。

/opt/upgw/libs/libnes_routefile/libnes_routefile.c: At top level:
/opt/upgw/libs/libnes_routefile/libnes_routefile.c:116:5: warning: no previous prototype for ‘nes_routefile_add_entry’ [-Wmissing-prototypes]

22、/* warning: no previous prototype for ‘nes_routefile_add_entry’ */
原因:同1。
修改方法:在相应的头文件中声明。

 int nes_routefile_add_entry(const char *sectionname, const char *entryname, const char *entryvalue)
     ^
/opt/upgw/libs/libnes_routefile/libnes_routefile.c: In function ‘nes_routefile_add_entry’:
/opt/upgw/libs/libnes_routefile/libnes_routefile.c:119:5: warning: passing argument 1 of ‘rte_cfgfile_add_entry’ from incompatible pointer type [enabled by default]
     return rte_cfgfile_add_entry(nes_routefile, sectionname, entryname, entryvalue);
     ^
In file included from /opt/upgw/libs/libnes_routefile/libnes_routefile.c:15:0:
/opt/dpdk-18.08/x86_64-native-linuxapp-gcc/include/rte_cfgfile.h:137:5: note: expected ‘struct rte_cfgfile *’ but argument is of type ‘struct rte_routefile *’
 int rte_cfgfile_add_entry(struct rte_cfgfile *cfg,
     ^
/opt/upgw/libs/libnes_routefile/libnes_routefile.c: At top level:
/opt/upgw/libs/libnes_routefile/libnes_routefile.c:122:5: warning: no previous prototype for ‘nes_routefile_save’ [-Wmissing-prototypes]
 int nes_routefile_save(char *filename)
     ^
/opt/upgw/libs/libnes_routefile/libnes_routefile.c: In function ‘nes_routefile_save’:
/opt/upgw/libs/libnes_routefile/libnes_routefile.c:127:5: warning: passing argument 1 of ‘rte_cfgfile_save’ from incompatible pointer type [enabled by default]
     return rte_cfgfile_save(nes_routefile, filename);
     ^
In file included from /opt/upgw/libs/libnes_routefile/libnes_routefile.c:15:0:
/opt/dpdk-18.08/x86_64-native-linuxapp-gcc/include/rte_cfgfile.h:168:5: note: expected ‘struct rte_cfgfile *’ but argument is of type ‘struct rte_routefile *’
 int rte_cfgfile_save(struct rte_cfgfile *cfg, const char *filename);
     ^
/opt/upgw/libs/libnes_routefile/libnes_routefile.c: At top level:
/opt/upgw/libs/libnes_routefile/libnes_routefile.c:130:5: warning: no previous prototype for ‘nes_routefile_set_entry’ [-Wmissing-prototypes]
 int nes_routefile_set_entry(const char *sectionname, const char *entryname, const char *entryvalue)
     ^
/opt/upgw/libs/libnes_routefile/libnes_routefile.c: In function ‘nes_routefile_set_entry’:
/opt/upgw/libs/libnes_routefile/libnes_routefile.c:133:5: warning: passing argument 1 of ‘rte_cfgfile_set_entry’ from incompatible pointer type [enabled by default]
     return rte_cfgfile_set_entry(nes_routefile, sectionname, entryname, entryvalue);
     ^
In file included from /opt/upgw/libs/libnes_routefile/libnes_routefile.c:15:0:
/opt/dpdk-18.08/x86_64-native-linuxapp-gcc/include/rte_cfgfile.h:155:5: note: expected ‘struct rte_cfgfile *’ but argument is of type ‘struct rte_routefile *’
 int rte_cfgfile_set_entry(struct rte_cfgfile *cfg, const char *sectionname,
     ^
/opt/upgw/libs/libnes_routefile/libnes_routefile.c: In function ‘nes_routefile_section_num_entries’:
/opt/upgw/libs/libnes_routefile/libnes_routefile.c:139:5: warning: passing argument 1 of ‘rte_cfgfile_section_num_entries’ from incompatible pointer type [enabled by default]
     return rte_cfgfile_section_num_entries(nes_routefile, sectionname);
     ^
In file included from /opt/upgw/libs/libnes_routefile/libnes_routefile.c:15:0:
/opt/dpdk-18.08/x86_64-native-linuxapp-gcc/include/rte_cfgfile.h:230:5: note: expected ‘struct rte_cfgfile *’ but argument is of type ‘struct rte_routefile *’
 int rte_cfgfile_section_num_entries(struct rte_cfgfile *cfg,
     ^
/opt/upgw/libs/libnes_routefile/libnes_routefile.c: In function ‘nes_routefile_close’:
/opt/upgw/libs/libnes_routefile/libnes_routefile.c:144:5: warning: passing argument 1 of ‘rte_cfgfile_close’ from incompatible pointer type [enabled by default]
     rte_cfgfile_close(nes_routefile);
     ^
In file included from /opt/upgw/libs/libnes_routefile/libnes_routefile.c:15:0:
/opt/dpdk-18.08/x86_64-native-linuxapp-gcc/include/rte_cfgfile.h:349:5: note: expected ‘struct rte_cfgfile *’ but argument is of type ‘struct rte_routefile *’
 int rte_cfgfile_close(struct rte_cfgfile *cfg);
     ^

23、/* warning: passing argument 1 of ‘rte_cfgfile_add_entry’ from incompatible pointer type */
原因:同4。
修改方法:同4。
/* warning: no previous prototype for ‘nes_routefile_save’ */
原因:同1。
修改方法:在对应的.h中声明。

/opt/upgw/libs/libnes_routefile/libnes_routefile.c: In function ‘nes_routefile_clear_deleted_entries’:
/opt/upgw/libs/libnes_routefile/libnes_routefile.c:67:14: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result [-Wunused-result]
         fgets(entry, 320, route_file);
              ^

24、/* warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result */
原因:同11。
修改方法:同11。

  AR libnes_routefile.a
  INSTALL-LIB libnes_routefile.a
== libnes_redis
  CC libnes_redis.o
/opt/upgw/libs/libnes_redis/libnes_redis.c:17:7: warning: no previous prototype for ‘get_rule_key’ [-Wmissing-prototypes]
 char *get_rule_key(uint8_t type) {
       ^

25、/* warning: no previous prototype for ‘get_rule_key’ */
原因:同1。
修改方法:加static修饰。

/opt/upgw/libs/libnes_redis/libnes_redis.c: In function ‘get_rule_key’:
/opt/upgw/libs/libnes_redis/libnes_redis.c:20:13: warning: return discards ‘const’ qualifier from pointer target type [enabled by default]
             return "traffic_rules";
             ^
/opt/upgw/libs/libnes_redis/libnes_redis.c:22:13: warning: return discards ‘const’ qualifier from pointer target type [enabled by default]
             return "dns_rules";
             ^
/opt/upgw/libs/libnes_redis/libnes_redis.c:25:13: warning: return discards ‘const’ qualifier from pointer target type [enabled by default]
             return INVALID_RULE;
             ^

26、/* return discards ‘const’ qualifier from pointer target type */
原因:同13。
修改方法:同13。

/opt/upgw/libs/libnes_redis/libnes_redis.c: At top level:
/opt/upgw/libs/libnes_redis/libnes_redis.c:29:15: warning: function declaration isn’t a prototype [-Wstrict-prototypes]
 redisContext *redis_connect() {
               ^
/opt/upgw/libs/libnes_redis/libnes_redis.c: In function ‘redis_connect’:
/opt/upgw/libs/libnes_redis/libnes_redis.c:29:15: warning: old-style function definition [-Wold-style-definition]

27、/* warning: function declaration isn’t a prototype */
/* warning: old-style function definition */
原因:同14。
修改方法:同14。

/opt/upgw/libs/libnes_redis/libnes_redis.c: In function ‘sync_get_number_of_rule’:
/opt/upgw/libs/libnes_redis/libnes_redis.c:170:9: warning: format ‘%d’ expects argument of type ‘int’, but argument 5 has type ‘long long int’ [-Wformat=]
         NES_LOG(INFO, "Get number of %s: %d successfully.\n", rule_key, reply->integer);
         ^

28、/* warning: format ‘%d’ expects argument of type ‘int’, but argument 5 has type ‘long long int’ */
原因:同15。
修改方法:同15。

/opt/upgw/libs/libnes_redis/libnes_redis.c: In function ‘sync_get_all_rule’:
/opt/upgw/libs/libnes_redis/libnes_redis.c:221:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for (i=0; i<count; i++) {
                    ^
/opt/upgw/libs/libnes_redis/libnes_redis.c:235:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for (i=0; i<count; i++) {
                    ^

29、/* warning: comparison between signed and unsigned integer expressions */
原因:同16。
修改方法:同16。

/opt/upgw/libs/libnes_redis/libnes_redis.c: In function ‘sync_put_rule’:
/opt/upgw/libs/libnes_redis/libnes_redis.c:106:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
/opt/upgw/libs/libnes_redis/libnes_redis.c: In function ‘sync_get_one_rule’:
/opt/upgw/libs/libnes_redis/libnes_redis.c:147:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
/opt/upgw/libs/libnes_redis/libnes_redis.c: In function ‘sync_get_number_of_rule’:
/opt/upgw/libs/libnes_redis/libnes_redis.c:181:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
/opt/upgw/libs/libnes_redis/libnes_redis.c: In function ‘sync_del_rule’:
/opt/upgw/libs/libnes_redis/libnes_redis.c:291:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^

30、/* warning: control reaches end of non-void function */
原因:同17。
修改方法:同17。

  AR libnes_redis.a
  INSTALL-LIB libnes_redis.a
== daemon
  CC nis/nis_io.o
  CC nis/nis_param.o
  CC nis/nis_routing_data.o
  CC nis/nis_acl.o
  CC nts/nts_io.o
  CC nts/nts_edit.o
/opt/upgw/daemon/nts/nts_edit.c: In function ‘nts_edge_dns_edit_hdr_parse_gtp’:
/opt/upgw/daemon/nts/nts_edit.c:324:17: warning: unused variable ‘dns_head_len’ [-Wunused-variable]
             int dns_head_len = sizeof(dns_header_t);
                 ^
31、/* warning: unused variable ‘dns_head_len’ */
原因:同2。
修改方法:同2。

/opt/upgw/daemon/nts/nts_edit.c: In function ‘nts_packet_edit_enq’:
/opt/upgw/daemon/nts/nts_edit.c:435:13: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 5 has type ‘uint64_t’ [-Wformat=]
             NES_LOG(DEBUG, "thread:nts_io, module:flow, portname:%s, index:%llu, traffic-direction:TO LBP, to_ring:%s\n", devices_tab[mbuf->port].device->name, mbuf->udata64, entry->dst_ring->ring->name);
             ^

32、/* warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 5 has type ‘uint64_t’ */
原因:变量类型与打印形式不匹配,uint64_t在32位系统中表示为long long int,在64位系统中表示long int。
修改方法:为了同时支持32位和64位操作系统,使用%"PRIu64"打印。

/opt/upgw/daemon/nts/nts_edit.c: In function ‘nts_flow_upstream_gtp’:
/opt/upgw/daemon/nts/nts_edit.c:455:5: warning: missing braces around initializer [-Wmissing-braces]
     nts_acl_tuple_t tuples[MAX_BURST_SIZE] = {0};
     ^
/opt/upgw/daemon/nts/nts_edit.c:455:5: warning: (near initialization for ‘tuples[0]’) [-Wmissing-braces]

33、/* warning: missing braces around initializer */
/* warning: (near initialization for ‘tuples[0]’) */
原因:初始化不合理。
修改方法:使用memset函数将结构体数组置0。

/opt/upgw/daemon/nts/nts_edit.c:481:21: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 5 has type ‘uint64_t’ [-Wformat=]
                     NES_LOG(DEBUG, "thread:nts_io, module:flow, portname:%s, index:%llu, traffic-direction:FROM UPSTR TO ENGRESS, proto-type:NONE_N3_N9, to_ring:%s\n", devices_tab[mbufs[i]->port].device->name, mbufs[i]->udata64, egress_ring->ring->name);
                     ^
34、/* warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 5 has type ‘uint64_t’ */
原因:同32。
修改方法:同32。

/opt/upgw/daemon/nts/nts_edit.c:501:13: warning: implicit declaration of function ‘domainname_check’ [-Wimplicit-function-declaration]
             if(NES_SUCCESS == domainname_check(domain_name, &ip)){
             ^
/opt/upgw/daemon/nts/nts_edit.c:501:13: warning: nested extern declaration of ‘domainname_check’ [-Wnested-externs]

35、/* warning: implicit declaration of function ‘domainname_check’ */
/* warning: nested extern declaration of ‘domainname_check’ */
原因:该函数未被声明就拿来使用。
修改方法:该函数在对应头文件中声明,若声明过引用头文件。

/opt/upgw/daemon/nts/nts_edit.c:522:16: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 5 has type ‘uint64_t’ [-Wformat=]
                NES_LOG(DEBUG, "thread:nts_io, module:flow, portname:%s, index:%llu, traffic-direction:FROM UPSTR TO DNS, proto-type:GTPU, to_ring:%s\n", devices_tab[mbufs[i]->port].device->name, mbufs[i]->udata64, ring->ring->name);
                ^
/opt/upgw/daemon/nts/nts_edit.c:540:13: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 5 has type ‘uint64_t’ [-Wformat=]
             NES_LOG(DEBUG, "thread:nts_io, module:flow, portname:%s, index:%llu, traffic-direction:FROM UPSTR TO ENGRESS, proto-type:GTPU, to_ring:%s\n", devices_tab[mbufs[i]->port].device->name, mbufs[i]->udata64, egress_ring->ring->name);
             ^
/opt/upgw/daemon/nts/nts_edit.c: In function ‘nts_flow_downstream_gtp’:
/opt/upgw/daemon/nts/nts_edit.c:580:21: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 5 has type ‘uint64_t’ [-Wformat=]
                     NES_LOG(DEBUG, "thread:nts_io, module:flow, portname:%s, index:%llu, traffic-direction:FROM DWSTR TO ENGRESS, proto-type:NONE_N3_N9, to_ring:%s\n", devices_tab[mbufs[i]->port].device->name, mbufs[i]->udata64, egress_ring->ring->name);
                     ^
/opt/upgw/daemon/nts/nts_edit.c:615:13: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 5 has type ‘uint64_t’ [-Wformat=]
             NES_LOG(DEBUG, "thread:nts_io, module:flow, portname:%s, index:%llu, traffic-direction:FROM DWSTR TO ENGRESS, proto-type:GTPU, to_ring:%s\n", devices_tab[mbufs[i]->port].device->name, mbufs[i]->udata64, egress_ring->ring->name);
             ^

36、/* warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 5 has type ‘uint64_t’ */
原因:同32。
修改方法:同32。

/opt/upgw/daemon/nts/nts_edit.c: In function ‘nts_egde_dns_check_hdr’:
/opt/upgw/daemon/nts/nts_edit.c:669:13: warning: unused variable ‘dns_head_len’ [-Wunused-variable]
         int dns_head_len = sizeof(dns_header_t);
             ^
/opt/upgw/daemon/nts/nts_edit.c: In function ‘nts_egde_dns_hdr_parse_ip’:
/opt/upgw/daemon/nts/nts_edit.c:710:13: warning: unused variable ‘dns_head_len’ [-Wunused-variable]
         int dns_head_len = sizeof(dns_header_t);
             ^

37、/* warning: unused variable ‘dns_head_len’ */
原因:同2。
修改方法:同2。

/opt/upgw/daemon/nts/nts_edit.c: In function ‘nts_flow_upstream_ip’:
/opt/upgw/daemon/nts/nts_edit.c:798:16: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 5 has type ‘uint64_t’ [-Wformat=]
                NES_LOG(DEBUG, "thread:nts_io, module:flow, portname:%s, index:%llu, traffic-direction:FROM UPSTR TO DNS, proto-type:IP, to_ring:%s\n", devices_tab[mbufs[i]->port].device->name, mbufs[i]->udata64, ring->ring->name);
                ^
/opt/upgw/daemon/nts/nts_edit.c:816:13: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 5 has type ‘uint64_t’ [-Wformat=]
             NES_LOG(DEBUG, "thread:nts_io, module:flow, portname:%s, index:%llu, traffic-direction:FROM UPSTR TO ENGRESS, proto-type:IP, to_ring:%s\n", devices_tab[mbufs[i]->port].device->name, mbufs[i]->udata64, egress_ring->ring->name);
             ^
/opt/upgw/daemon/nts/nts_edit.c: In function ‘nts_flow_downstream_ip’:
/opt/upgw/daemon/nts/nts_edit.c:874:13: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 5 has type ‘uint64_t’ [-Wformat=]
             NES_LOG(DEBUG, "thread:nts_io, module:flow, portname:%s, index:%llu, traffic-direction:FROM DWSTR TO ENGRESS, proto-type:IP, to_ring:%s\n", devices_tab[mbufs[i]->port].device->name, mbufs[i]->udata64, egress_ring->ring->name);
             ^

38、/* warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 5 has type ‘uint64_t’ */
原因:同32。
修改方法:同32。

/opt/upgw/daemon/nts/nts_edit.c: In function ‘nts_edge_arp_check’:
/opt/upgw/daemon/nts/nts_edit.c:1065:5: warning: return makes pointer from integer without a cast [enabled by default]
     return NES_FAIL;
     ^

39、/* warning: return makes pointer from integer without a cast */
原因:函数定义的返回值和实际返回值不是一个类型。
修改方法:返回值和定义的类型改为一致,变为int。

/opt/upgw/daemon/nts/nts_edit.c: In function ‘nts_edge_arp_edit’:
/opt/upgw/daemon/nts/nts_edit.c:1075:12: warning: missing braces around initializer [-Wmissing-braces]
     struct dns_lbp_data_s lbp = {0};
            ^
/opt/upgw/daemon/nts/nts_edit.c:1075:12: warning: (near initialization for ‘lbp.mac’) [-Wmissing-braces]
/opt/upgw/daemon/nts/nts_edit.c:1075:12: warning: missing initializer for field ‘port_id’ of ‘struct dns_lbp_data_s’ [-Wmissing-field-initializers]
In file included from /opt/upgw/daemon/nts/nts_edit.c:39:0:
/opt/upgw//daemon/nts/nts_domainame.h:78:9: note: ‘port_id’ declared here
     int port_id;
         ^

40、/* warning: missing braces around initializer */
原因:同33。
修改方法:同33。

/opt/upgw/daemon/nts/nts_edit.c:1110:5: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 5 has type ‘uint64_t’ [-Wformat=]
     NES_LOG(DEBUG, "thread:nts_io, module:flow, portname:%s, index:%llu, srcip:%s, dstip:%s, traffic-direction:FROM LBP TO LBP, proto-type:ARP REPLY, to_ring:%s\n", devices_tab[mbuf->port].device->name, mbuf->udata64, src_ip, dst_ip, dst_ring->ring->name);
     ^

41、/* warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 5 has type ‘uint64_t’ */
原因:同32。
修改方法:同32。

/opt/upgw/daemon/nts/nts_edit.c:1075:27: warning: unused variable ‘lbp’ [-Wunused-variable]
     struct dns_lbp_data_s lbp = {0};
                           ^
/opt/upgw/daemon/nts/nts_edit.c:1073:22: warning: unused variable ‘vlan_hdr’ [-Wunused-variable]
     struct vlan_hdr *vlan_hdr;
                      ^

42、/* warning: unused variable ‘lbp’ */
原因:同2。
修改方法:同2。

/opt/upgw/daemon/nts/nts_edit.c: In function ‘nts_flow_vm’:
/opt/upgw/daemon/nts/nts_edit.c:1209:13: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 5 has type ‘uint64_t’ [-Wformat=]
             NES_LOG(DEBUG, "thread:nts_io, module:flow, portname:%s, index:%llu, srcip:%s, dstip:%s, traffic-direction:FROM LBP, proto-type:ARP REQUEST\n", devices_tab[mbufs[i]->port].device->name, mbufs[i]->udata64, src_ip, dst_ip);
             ^

43、/* warning: format ‘%llu’ expects argument of type ‘long long unsigned int’ */
原因:同32。
修改方法:同32。

/opt/upgw/daemon/nts/nts_edit.c:1239:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if (RTE_LOG_DEBUG <= rte_log_get_level(logtype_nes)) {
                           ^

44、/* warning: comparison between signed and unsigned integer expressions */
原因:同16。
修改方法:将RTE_LOG_DEBUG强转为int类型。

/opt/upgw/daemon/nts/nts_edit.c:1241:17: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 5 has type ‘uint64_t’ [-Wformat=]
                 NES_LOG(DEBUG, "thread:nts_io, module:flow, portname:%s, index:%llu, srcip:%s, dstip:%s, traffic-direction:FROM LBP TO ENGRESS, proto-type:GTPU, to_ring:%s\n", devices_tab[mbufs[idx]->port].device->name, mbufs[idx]->udata64, src_ip, dst_ip, egress_ring->ring->name);
                 ^
/opt/upgw/daemon/nts/nts_edit.c:1243:17: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 5 has type ‘uint64_t’ [-Wformat=]
                 NES_LOG(DEBUG, "thread:nts_io, module:flow, portname:%s, index:%llu, srcip:%s, dstip:%s, traffic-direction:FROM LBP TO ENGRESS, proto-type:IP, to_ring:%s\n", devices_tab[mbufs[idx]->port].device->name, mbufs[idx]->udata64, src_ip, dst_ip, egress_ring->ring->name);
                 ^

45、/* warning: format ‘%llu’ expects argument of type ‘long long unsigned int’ */
原因:同32。
修改方法:同32。

/opt/upgw/daemon/nts/nts_edit.c: At top level:
/opt/upgw/daemon/nts/nts_edit.c:1258:5: warning: no previous prototype for ‘nts_edge_dns_decap_ip’ [-Wmissing-prototypes]
 int nts_edge_dns_decap_ip(struct rte_mbuf *src_mbuf)
     ^

46、/* warning: no previous prototype for ‘nts_edge_dns_decap_ip’ */
原因:同1。
修改方法:加static修饰。

/opt/upgw/daemon/nts/nts_edit.c: In function ‘nts_edge_dns_decap_ip’:
/opt/upgw/daemon/nts/nts_edit.c:1266:12: warning: missing braces around initializer [-Wmissing-braces]
     struct dns_lbp_data_s lbp = {0};
            ^
/opt/upgw/daemon/nts/nts_edit.c:1266:12: warning: (near initialization for ‘lbp.mac’) [-Wmissing-braces]
/opt/upgw/daemon/nts/nts_edit.c:1266:12: warning: missing initializer for field ‘port_id’ of ‘struct dns_lbp_data_s’ [-Wmissing-field-initializers]
In file included from /opt/upgw/daemon/nts/nts_edit.c:39:0:
/opt/upgw//daemon/nts/nts_domainame.h:78:9: note: ‘port_id’ declared here
     int port_id;
         ^

47、/* warning: missing braces around initializer */
原因:同33。
修改方法:同33。

/opt/upgw/daemon/nts/nts_edit.c:1278:5: warning: implicit declaration of function ‘lbp_data_get’ [-Wimplicit-function-declaration]
     if(NES_SUCCESS != lbp_data_get(&lbp)){
     ^
/opt/upgw/daemon/nts/nts_edit.c:1278:5: warning: nested extern declaration of ‘lbp_data_get’ [-Wnested-externs]

48、/*warning: implicit declaration of function ‘lbp_data_get’ */
/* warning: nested extern declaration of ‘lbp_data_get’ */
原因:同35。
修改方法:同35。

/opt/upgw/daemon/nts/nts_edit.c:1337:5: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 5 has type ‘uint64_t’ [-Wformat=]
     NES_LOG(DEBUG, "thread:nts_io, module:flow, portname:%s, index:%llu, traffic-direction:FROM DNS, proto-type:IP, to_ring:%s\n", devices_tab[src_mbuf->port].device->name, src_mbuf->udata64, dst_ring->ring->name);
     ^

49、/* warning: format ‘%llu’ expects argument of type ‘long long unsigned int’ */
原因:同32。
修改方法:同32。

/opt/upgw/daemon/nts/nts_edit.c:1340:9: warning: implicit declaration of function ‘dns_pkt_key_invalid_date_clear’ [-Wimplicit-function-declaration]
         dns_pkt_key_invalid_date_clear();
         ^
/opt/upgw/daemon/nts/nts_edit.c:1340:9: warning: nested extern declaration of ‘dns_pkt_key_invalid_date_clear’ [-Wnested-externs]

50、/*warning: implicit declaration of function ‘dns_pkt_key_invalid_date_clear’ */
/* warning: nested extern declaration of ‘dns_pkt_key_invalid_date_clear’ */
原因:同35。
修改方法:同35。

/opt/upgw/daemon/nts/nts_edit.c:1267:22: warning: unused variable ‘ipv4_hdr’ [-Wunused-variable]
     struct ipv4_hdr *ipv4_hdr;
                      ^
/opt/upgw/daemon/nts/nts_edit.c:1264:22: warning: unused variable ‘mbuf’ [-Wunused-variable]
     struct rte_mbuf *mbuf;
                      ^
/opt/upgw/daemon/nts/nts_edit.c:1263:22: warning: unused variable ‘hdr’ [-Wunused-variable]
     struct rte_mbuf *hdr;
                      ^
/opt/upgw/daemon/nts/nts_edit.c:1262:21: warning: unused variable ‘tcphdr’ [-Wunused-variable]
     struct tcp_hdr *tcphdr;
                     ^
/opt/upgw/daemon/nts/nts_edit.c:1261:22: warning: unused variable ‘new_iphdr’ [-Wunused-variable]
     struct ipv4_hdr *new_iphdr, *iphdr; /* Original inner ipv4 header*/
                      ^
/opt/upgw/daemon/nts/nts_edit.c:1260:23: warning: unused variable ‘new_ethhdr’ [-Wunused-variable]
     struct ether_hdr *new_ethhdr, *ethhdr;
                       ^
/opt/upgw/daemon/nts/nts_edit.c: In function ‘nts_edge_dns_hdr_parse_gtp’:
/opt/upgw/daemon/nts/nts_edit.c:1427:17: warning: unused variable ‘dns_head_len’ [-Wunused-variable]
             int dns_head_len = sizeof(dns_header_t);
                 ^
/opt/upgw/daemon/nts/nts_edit.c:1356:22: warning: variable ‘vlan’ set but not used [-Wunused-but-set-variable]
     struct vlan_hdr *vlan;
                      ^
/opt/upgw/daemon/nts/nts_edit.c:1355:15: warning: variable ‘inner_src_port’ set but not used [-Wunused-but-set-variable]
     uint16_t* inner_src_port;
               ^

51、/* warning: unused variable ‘ipv4_hdr’ */
原因:同2。
修改方法:同2。

/opt/upgw/daemon/nts/nts_edit.c: At top level:
/opt/upgw/daemon/nts/nts_edit.c:1457:5: warning: no previous prototype for ‘nts_edge_dns_decap_gtp’ [-Wmissing-prototypes]
 int nts_edge_dns_decap_gtp(struct rte_mbuf *src_mbuf)
     ^

52、/* warning: no previous prototype for ‘nts_edge_dns_decap_gtp’ */
原因:同1。
修改方法:加static修饰。

/opt/upgw/daemon/nts/nts_edit.c: In function ‘nts_edge_dns_decap_gtp’:
/opt/upgw/daemon/nts/nts_edit.c:1462:12: warning: missing braces around initializer [-Wmissing-braces]
     struct dns_lbp_data_s lbp = {0};
            ^
/opt/upgw/daemon/nts/nts_edit.c:1462:12: warning: (near initialization for ‘lbp.mac’) [-Wmissing-braces]
/opt/upgw/daemon/nts/nts_edit.c:1462:12: warning: missing initializer for field ‘port_id’ of ‘struct dns_lbp_data_s’ [-Wmissing-field-initializers]
In file included from /opt/upgw/daemon/nts/nts_edit.c:39:0:
/opt/upgw//daemon/nts/nts_domainame.h:78:9: note: ‘port_id’ declared here
     int port_id;
         ^
/opt/upgw/daemon/nts/nts_edit.c:1464:12: warning: missing braces around initializer [-Wmissing-braces]
     struct ether_addr s_addr = {0};
            ^
/opt/upgw/daemon/nts/nts_edit.c:1464:12: warning: (near initialization for ‘s_addr.addr_bytes’) [-Wmissing-braces]

53、/* warning: missing braces around initializer */
/* warning: missing initializer for field ‘port_id’ of ‘struct dns_lbp_data_s’ */
原因:同33。
修改方法:同33。

/opt/upgw/daemon/nts/nts_edit.c:1538:5: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 5 has type ‘uint64_t’ [-Wformat=]
     NES_LOG(DEBUG, "thread:nts_io, module:flow, portname:%s, index:%llu, traffic-direction:FROM DNS, proto-type:GTPU, to_ring:%s\n", devices_tab[src_mbuf->port].device->name, src_mbuf->udata64, dst_ring->ring->name);
     ^

54、/* warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 5 has type ‘uint64_t’ */
原因:同32。
修改方法:同32。

/opt/upgw/daemon/nts/nts_edit.c:1470:24: warning: unused variable ‘entry’ [-Wunused-variable]
     nts_enc_subentry_t entry;
                        ^
/opt/upgw/daemon/nts/nts_edit.c:1463:22: warning: unused variable ‘ipv4_hdr’ [-Wunused-variable]
     struct ipv4_hdr *ipv4_hdr;
                      ^

55、/* warning: unused variable ‘entry’ */
原因:同2。
修改方法:同2。

/opt/upgw/daemon/nts/nts_edit.c: At top level:
/opt/upgw/daemon/nts/nts_edit.c:1546:5: warning: no previous prototype for ‘nts_edge_dns_decap’ [-Wmissing-prototypes]
 int nts_edge_dns_decap(struct rte_mbuf *src_mbuf)
     ^

56、/* warning: no previous prototype for ‘nts_edge_dns_decap’ */
原因:同1。
修改方法:加static修饰。

/opt/upgw/daemon/nts/nts_edit.c: In function ‘nts_edge_dns_decap’:
/opt/upgw/daemon/nts/nts_edit.c:1556:12: warning: missing braces around initializer [-Wmissing-braces]
     struct dns_lbp_data_s lbp = {0};
            ^
/opt/upgw/daemon/nts/nts_edit.c:1556:12: warning: (near initialization for ‘lbp.mac’) [-Wmissing-braces]
/opt/upgw/daemon/nts/nts_edit.c:1556:12: warning: missing initializer for field ‘port_id’ of ‘struct dns_lbp_data_s’ [-Wmissing-field-initializers]
In file included from /opt/upgw/daemon/nts/nts_edit.c:39:0:
/opt/upgw//daemon/nts/nts_domainame.h:78:9: note: ‘port_id’ declared here
     int port_id;
         ^

57、/* missing braces around initializer */
原因:同33。
修改方法:同33。

/opt/upgw/daemon/nts/nts_edit.c:1565:9: warning: unused variable ‘ret’ [-Wunused-variable]
     int ret = NES_SUCCESS;
         ^
/opt/upgw/daemon/nts/nts_edit.c:1563:14: warning: unused variable ‘edge_dns_ip’ [-Wunused-variable]
     uint32_t edge_dns_ip = 0;
              ^
/opt/upgw/daemon/nts/nts_edit.c:1562:14: warning: unused variable ‘transaction’ [-Wunused-variable]
     uint16_t transaction = 0;
              ^
/opt/upgw/daemon/nts/nts_edit.c:1561:21: warning: unused variable ‘tuple’ [-Wunused-variable]
     nts_acl_tuple_t tuple;
                     ^
/opt/upgw/daemon/nts/nts_edit.c:1560:24: warning: unused variable ‘entry’ [-Wunused-variable]
     nts_enc_subentry_t entry;
                        ^
/opt/upgw/daemon/nts/nts_edit.c:1558:10: warning: unused variable ‘domain_name’ [-Wunused-variable]
     char domain_name[DOMAIN_NAME_SUPPORT_MAX] = {0};
          ^
/opt/upgw/daemon/nts/nts_edit.c:1553:22: warning: unused variable ‘ip_hdr’ [-Wunused-variable]
     struct ipv4_hdr *ip_hdr;
                      ^
/opt/upgw/daemon/nts/nts_edit.c:1552:22: warning: unused variable ‘mbuf’ [-Wunused-variable]
     struct rte_mbuf *mbuf;
                      ^
/opt/upgw/daemon/nts/nts_edit.c:1551:22: warning: unused variable ‘hdr’ [-Wunused-variable]
     struct rte_mbuf *hdr;
                      ^
/opt/upgw/daemon/nts/nts_edit.c:1550:21: warning: unused variable ‘tcphdr’ [-Wunused-variable]
     struct tcp_hdr *tcphdr;
                     ^
/opt/upgw/daemon/nts/nts_edit.c:1549:34: warning: unused variable ‘iphdr’ [-Wunused-variable]
     struct ipv4_hdr *new_iphdr, *iphdr; /* Original inner ipv4 header*/
                                  ^
/opt/upgw/daemon/nts/nts_edit.c:1549:22: warning: unused variable ‘new_iphdr’ [-Wunused-variable]
     struct ipv4_hdr *new_iphdr, *iphdr; /* Original inner ipv4 header*/
                      ^
/opt/upgw/daemon/nts/nts_edit.c:1548:23: warning: unused variable ‘new_ethhdr’ [-Wunused-variable]
     struct ether_hdr *new_ethhdr, *ethhdr;
                       ^

58、/* warning: unused variable ‘ret’ */
原因:同2。
修改方法:同2。

/opt/upgw/daemon/nts/nts_edit.c: At top level:
/opt/upgw/daemon/nts/nts_edit.c:1609:5: warning: no previous prototype for ‘nts_flow_edge_dns’ [-Wmissing-prototypes]
 int nts_flow_edge_dns(nes_ring_t *ingress_ring, void **buffer, int mbuf_num)
     ^

59、/* warning: no previous prototype for ‘nts_flow_edge_dns’ */
原因:同1。
修改方法:加static修饰。

/opt/upgw/daemon/nts/nts_edit.c: In function ‘nts_flow_edge_dns’:
/opt/upgw/daemon/nts/nts_edit.c:1609:35: warning: unused parameter ‘ingress_ring’ [-Wunused-parameter]
 int nts_flow_edge_dns(nes_ring_t *ingress_ring, void **buffer, int mbuf_num)
                                   ^

60、/* warning: unused parameter ‘ingress_ring’ */
原因:函数中定义的入参没有使用到。
修改方法:为了保证注册函数的一致性,这里不能删除入参,所以增加了对ingress_ring的判断代码:
if (NULL == ingress_ring) {
    return ret;
}

/opt/upgw/daemon/nts/nts_edit.c: In function ‘nts_flow_upstream_gtp’:
/opt/upgw/daemon/nts/nts_edit.c:319:25: warning: ‘inner_ipv4_hdr’ may be used uninitialized in this function [-Wmaybe-uninitialized]
     if((*inner_ipv4_hdr)->next_proto_id == IP_PROTO_UDP){
                         ^
/opt/upgw/daemon/nts/nts_edit.c:454:22: note: ‘inner_ipv4_hdr’ was declared here
     struct ipv4_hdr *inner_ipv4_hdr;
                      ^
/opt/upgw/daemon/nts/nts_edit.c: In function ‘nts_flow_downstream_gtp’:
/opt/upgw/daemon/nts/nts_edit.c:589:49: warning: ‘inner_ipv4_hdr’ may be used uninitialized in this function [-Wmaybe-uninitialized]
         nes_lookup_entry_find(lookup->learning, &inner_ipv4_hdr->dst_addr, (void**) &entry);
                                                 ^
/opt/upgw/daemon/nts/nts_edit.c: In function ‘nts_get_dst_ring’:
/opt/upgw/daemon/nts/nts_edit.c:211:44: warning: ‘inner_ipv4_hdr’ may be used uninitialized in this function [-Wmaybe-uninitialized]
     tuple->inner_ip_src = (*inner_ipv4_hdr)->src_addr;
                                            ^
/opt/upgw/daemon/nts/nts_edit.c:627:22: note: ‘inner_ipv4_hdr’ was declared here
     struct ipv4_hdr *inner_ipv4_hdr;
                      ^

61、/* warning: ‘inner_ipv4_hdr’ may be used uninitialized in this function */
原因:inner_ipv4_hdr指针未初始化。
修改方法:inner_ipv4_hdr赋予初值NULL。

  CC nts/nts_lookup.o
  CC ctrl/nes_ctrl.o
/opt/upgw/daemon/ctrl/nes_ctrl.c: In function ‘is_uuid_string’:
/opt/upgw/daemon/ctrl/nes_ctrl.c:102:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (i = 0; i < sizeof(fmt); i++) {
                   ^

62、/* warning: comparison between signed and unsigned integer expressions */
原因:同16。
修改方法:修改i为size_t类型。

/opt/upgw/daemon/ctrl/nes_ctrl.c: In function ‘nes_ctrl_route_add_impl’:
/opt/upgw/daemon/ctrl/nes_ctrl.c:468:21: warning: passing argument 1 of ‘nes_uuid_lookup_entry_add’ from incompatible pointer type [enabled by default]
                     &uuid_data)) {
                     ^
In file included from /opt/upgw/daemon/ctrl/nes_ctrl.c:49:0:
/opt/upgw//daemon/ctrl/nes_uuid_lookup.h:27:5: note: expected ‘const char *’ but argument is of type ‘char (*)[37]’
 int nes_uuid_lookup_entry_add(const char *, struct uuid_entry *data);
     ^

63、/* warning: passing argument 1 of ‘nes_uuid_lookup_entry_add’ from incompatible pointer type */
原因:传参类型不正确。
修改方法:传入参数时强转为为const char *类型。

/opt/upgw/daemon/ctrl/nes_ctrl.c:484:9: warning: implicit declaration of function ‘nes_acl_ether_to_str’ [-Wimplicit-function-declaration]
         if (NES_SUCCESS != nes_acl_ether_to_str(ether_addr_str, &data->vm_mac_addr)) {
         ^
/opt/upgw/daemon/ctrl/nes_ctrl.c:484:9: warning: nested extern declaration of ‘nes_acl_ether_to_str’ [-Wnested-externs]

64、/* warning: implicit declaration of function ‘nes_acl_ether_to_str’ */
/* warning: nested extern declaration of ‘nes_acl_ether_to_str’ */
原因:同35。
修改方法:同35。

/opt/upgw/daemon/ctrl/nes_ctrl.c:419:17: warning: unused variable ‘entry_deleted’ [-Wunused-variable]
     static char entry_deleted[] = "Deleted";
                 ^
/opt/upgw/daemon/ctrl/nes_ctrl.c:418:17: warning: unused variable ‘section_name’ [-Wunused-variable]
     static char section_name[] = TRAFFIC_RULE_ENTRY;
                 ^

65、/* warning: unused variable ‘entry_deleted’ */
原因:同2。
修改方法:同2。

/opt/upgw/daemon/ctrl/nes_ctrl.c: In function ‘nes_ctrl_domain_name_add_impl’:
/opt/upgw/daemon/ctrl/nes_ctrl.c:679:5: warning: implicit declaration of function ‘prepare_dns_rule_entries’ [-Wimplicit-function-declaration]
     if (NES_FAIL == prepare_dns_rule_entries(req_data->lookup, &domainame_entry)) {
     ^
/opt/upgw/daemon/ctrl/nes_ctrl.c:679:5: warning: nested extern declaration of ‘prepare_dns_rule_entries’ [-Wnested-externs]

66、/* warning: implicit declaration of function ‘prepare_dns_rule_entries’ */
原因:同35。
修改方法:同35。

/opt/upgw/daemon/ctrl/nes_ctrl.c: In function ‘nes_domainame_del’:
/opt/upgw/daemon/ctrl/nes_ctrl.c:711:5: warning: pointer targets in passing argument 1 of ‘is_uuid_string’ differ in signedness [-Wpointer-sign]
     if (NES_FAIL == is_uuid_string(api_msg->data)) {
     ^
/opt/upgw/daemon/ctrl/nes_ctrl.c:96:12: note: expected ‘const char *’ but argument is of type ‘uint8_t *’
 static int is_uuid_string(const char *uuid)
            ^
/opt/upgw/daemon/ctrl/nes_ctrl.c:724:5: warning: pointer targets in passing argument 2 of ‘sync_get_one_rule’ differ in signedness [-Wpointer-sign]
     if (NES_FAIL == sync_get_one_rule(DNS_RULE, api_msg->data, &dns_rule)) {
     ^
In file included from /opt/upgw/daemon/ctrl/nes_ctrl.c:60:0:
/opt/upgw//libs/libnes_redis/libnes_redis.h:52:5: note: expected ‘char *’ but argument is of type ‘uint8_t *’
 int sync_get_one_rule(uint8_t type, char *uuid, nes_rule_t *rule);
     ^
/opt/upgw/daemon/ctrl/nes_ctrl.c: In function ‘nes_domainame_show’:
/opt/upgw/daemon/ctrl/nes_ctrl.c:764:5: warning: pointer targets in passing argument 1 of ‘is_uuid_string’ differ in signedness [-Wpointer-sign]
     if (NES_FAIL == is_uuid_string(api_msg->data)) {
     ^
/opt/upgw/daemon/ctrl/nes_ctrl.c:96:12: note: expected ‘const char *’ but argument is of type ‘uint8_t *’
 static int is_uuid_string(const char *uuid)
            ^
/opt/upgw/daemon/ctrl/nes_ctrl.c:781:5: warning: pointer targets in passing argument 2 of ‘sync_get_one_rule’ differ in signedness [-Wpointer-sign]
     if (NES_FAIL == sync_get_one_rule(DNS_RULE, api_msg->data, &dns_rule)) {
     ^
In file included from /opt/upgw/daemon/ctrl/nes_ctrl.c:60:0:
/opt/upgw//libs/libnes_redis/libnes_redis.h:52:5: note: expected ‘char *’ but argument is of type ‘uint8_t *’
 int sync_get_one_rule(uint8_t type, char *uuid, nes_rule_t *rule);
     ^

67、/* warning: pointer targets in passing argument 1 of ‘is_uuid_string’ differ in signedness */
原因:同63。
修改方法:强转为需要的类型。

/opt/upgw/daemon/ctrl/nes_ctrl.c: In function ‘nes_domainame_list’:
/opt/upgw/daemon/ctrl/nes_ctrl.c:814:9: warning: unused variable ‘j’ [-Wunused-variable]
     int j = 0;
         ^
/opt/upgw/daemon/ctrl/nes_ctrl.c:812:27: warning: unused variable ‘route_list_req’ [-Wunused-variable]
     nes_route_list_req_t *route_list_req;
                           ^
/opt/upgw/daemon/ctrl/nes_ctrl.c:809:14: warning: unused variable ‘entry_cnt’ [-Wunused-variable]
     uint32_t entry_cnt = 0;
              ^

68、/* warning: unused variable ‘j’ */
原因:同2。
修改方法:同2。

/opt/upgw/daemon/ctrl/nes_ctrl.c: In function ‘nes_sync_data’:
/opt/upgw/daemon/ctrl/nes_ctrl.c:837:52: warning: unused parameter ‘api_msg’ [-Wunused-parameter]
 static nes_api_msg_t *nes_sync_data(nes_api_msg_t *api_msg)
                                                    ^

69、/* warning: unused parameter ‘api_msg’ */
原因:同60。
修改方法:删除该参数。

/opt/upgw/daemon/ctrl/nes_ctrl.c: In function ‘nes_bypass_server’:
/opt/upgw/daemon/ctrl/nes_ctrl.c:1002:5: warning: implicit declaration of function ‘parse’ [-Wimplicit-function-declaration]
     if (NES_SUCCESS != parse(lookup_entries, bypass_parameter_list)) {
     ^
/opt/upgw/daemon/ctrl/nes_ctrl.c:1002:5: warning: nested extern declaration of ‘parse’ [-Wnested-externs]

70、/* warning: implicit declaration of function ‘parse’ */
原因:同35。
修改方法:同35。

/opt/upgw/daemon/ctrl/nes_ctrl.c: In function ‘nes_ctrl_route_del_by_uuid’:
/opt/upgw/daemon/ctrl/nes_ctrl.c:1262:9: warning: unused variable ‘del_success’ [-Wunused-variable]
     int del_success = NES_FAIL;
         ^
/opt/upgw/daemon/ctrl/nes_ctrl.c:1261:14: warning: unused variable ‘i’ [-Wunused-variable]
     int ret, i;
              ^
/opt/upgw/daemon/ctrl/nes_ctrl.c:1260:30: warning: unused variable ‘route_entries’ [-Wunused-variable]
     struct rte_cfgfile_entry route_entries[MAX_LOOKUPS_PER_VM];
                              ^
/opt/upgw/daemon/ctrl/nes_ctrl.c:1259:17: warning: unused variable ‘entry_deleted’ [-Wunused-variable]
     static char entry_deleted[] = "Deleted";
                 ^
/opt/upgw/daemon/ctrl/nes_ctrl.c:1258:17: warning: unused variable ‘section_name’ [-Wunused-variable]
     static char section_name[] = TRAFFIC_RULE_ENTRY;
                 ^

71、/* warning: unused variable ‘del_success’ */
原因:同2。
修改方法:同2。

In file included from /opt/upgw/daemon/ctrl/nes_ctrl.c:42:0:
/opt/upgw/daemon/ctrl/nes_ctrl.c: At top level:
/opt/upgw//daemon/io/nes_dev_kni.h:22:29: warning: ‘nes_dev_kni_alloc’ declared ‘static’ but never defined [-Wunused-function]
 NES_STATIC struct rte_kni * nes_dev_kni_alloc(uint16_t port_id, const char* if_id);
                             ^
In file included from /opt/upgw/daemon/ctrl/nes_ctrl.c:60:0:
/opt/upgw//libs/libnes_redis/libnes_redis.h:12:13: warning: ‘REDIS_HOST’ defined but not used [-Wunused-variable]
 static char REDIS_HOST[50];
             ^
/opt/upgw//libs/libnes_redis/libnes_redis.h:13:17: warning: ‘REDIS_PORT’ defined but not used [-Wunused-variable]
 static uint16_t REDIS_PORT;
                 ^

72、/* ‘nes_dev_kni_alloc’ declared ‘static’ but never defined [-Wunused-function] */
/* warning: ‘REDIS_HOST’ defined but not used [-Wunused-variable] */
原因:static修饰的函数和变量已经在.c文件中定义,不需要在.h声明,若没有static修饰,可以在.h声明,变量声明必须要用extern修饰。
修改方法:将这几处删除。

  CC nes_main.o
/opt/upgw/daemon/nes_main.c:147:6: warning: function declaration isn’t a prototype [-Wstrict-prototypes]
 void nes_bypass_reset_wd()
      ^
/opt/upgw/daemon/nes_main.c: In function ‘nes_bypass_reset_wd’:
/opt/upgw/daemon/nes_main.c:147:6: warning: old-style function definition [-Wold-style-definition]

73、/* warning: function declaration isn’t a prototype */
/* warning: old-style function definition */
原因:同14。
修改方法:同14。

/opt/upgw/daemon/nes_main.c:159:34: warning: assignment discards ‘const’ qualifier from pointer target type [enabled by default]
         bypass_parameter_list[0] = "all";
                                  ^
/opt/upgw/daemon/nes_main.c:160:34: warning: assignment discards ‘const’ qualifier from pointer target type [enabled by default]
         bypass_parameter_list[1] = "reset_bypass_wd";
                                  ^
/opt/upgw/daemon/nes_main.c:177:38: warning: assignment discards ‘const’ qualifier from pointer target type [enabled by default]
             bypass_parameter_list[1] = "reset_bypass_wd";
                                      ^

74、/* warning: assignment discards ‘const’ qualifier from pointer target type */         原因:赋值时两端类型不一致。
修改方法:定义bypass_parameter_list时加上const,后续的用此参数的函数也加const关键词。

/opt/upgw/daemon/nes_main.c: In function ‘main’:
/opt/upgw/daemon/nes_main.c:254:5: warning: passing argument 1 of ‘init_redis_config’ discards ‘const’ qualifier from pointer target type [enabled by default]
     init_redis_config(redis_host, atoi(redis_port));
     ^
In file included from /opt/upgw/daemon/nes_main.c:38:0:
/opt/upgw//libs/libnes_redis/libnes_redis.h:32:6: note: expected ‘char *’ but argument is of type ‘const char *’
 void init_redis_config(char *host, uint16_t port);
      ^

75、/* warning: passing argument 1 of ‘init_redis_config’ discards ‘const’ qualifier from pointer target type */
/* note: expected ‘char *’ but argument is of type ‘const char * */
原因:同63。
修改方法:init_redis_config定义时第一个参数加const修饰。

/opt/upgw/daemon/nes_main.c:311:21: warning: implicit declaration of function ‘nes_routefile_close’ [-Wimplicit-function-declaration]
                     nes_routefile_close();
                     ^
/opt/upgw/daemon/nes_main.c:311:21: warning: nested extern declaration of ‘nes_routefile_close’ [-Wnested-externs]

76、/* warning: implicit declaration of function ‘nes_routefile_close’ */
/* warning: nested extern declaration of ‘nes_routefile_close’ */
原因:同35。
修改方法:同35。

/opt/upgw/daemon/nes_main.c:192:13: warning: unused variable ‘nes_route_file’ [-Wunused-variable]
     char   *nes_route_file = NULL;
             ^

77、/* warning: unused variable ‘nes_route_file’ */
原因:同2。
修改方法:同2。

In file included from /opt/upgw/daemon/nes_main.c:27:0:
/opt/upgw/daemon/nes_main.c: At top level:
/opt/upgw/daemon/io/nes_dev_kni.h:22:29: warning: ‘nes_dev_kni_alloc’ declared ‘static’ but never defined [-Wunused-function]
 NES_STATIC struct rte_kni * nes_dev_kni_alloc(uint16_t port_id, const char* if_id);
                             ^
In file included from /opt/upgw/daemon/nes_main.c:38:0:
/opt/upgw//libs/libnes_redis/libnes_redis.h:12:13: warning: ‘REDIS_HOST’ defined but not used [-Wunused-variable]
 static char REDIS_HOST[50];
             ^
/opt/upgw//libs/libnes_redis/libnes_redis.h:13:17: warning: ‘REDIS_PORT’ defined but not used [-Wunused-variable]
 static uint16_t REDIS_PORT;
                 ^
78、/* warning: ‘nes_dev_kni_alloc’ declared ‘static’ but never defined */
/* warning: ‘REDIS_HOST’ defined but not used */
原因:同72。
修改方法:同72。

  CC nes_ring.o
  CC nes_ring_lookup.o
  CC ctrl/nes_tcp_connection.o
  CC ctrl/nes_configuration.o
  CC ctrl/nes_uuid_lookup.o
/opt/upgw/daemon/ctrl/nes_uuid_lookup.c:54:5: warning: no previous prototype for ‘nes_uuid_lookup_entry_get’ [-Wmissing-prototypes]
 int nes_uuid_lookup_entry_get(const char *route_rule_uuid, struct uuid_entry **data)
     ^

79、/* warning: no previous prototype for ‘nes_uuid_lookup_entry_get’ */
原因:同1。
修改方法:在对应.h文件中声明。

/opt/upgw/daemon/ctrl/nes_uuid_lookup.c: In function ‘nes_uuid_lookup_entry_del’:
/opt/upgw/daemon/ctrl/nes_uuid_lookup.c:76:10: warning: unused variable ‘route_rule_uuid_str’ [-Wunused-variable]
     char route_rule_uuid_str[UUID_STR_LEN];
          ^

80、/* warning: unused variable ‘route_rule_uuid_str’ */
原因:同2。
修改方法:同2。

  CC nts/nts_acl.o
/opt/upgw/daemon/nts/nts_acl.c: In function ‘nes_routefile_parse_entryname’:
/opt/upgw/daemon/nts/nts_acl.c:150:9: warning: passing argument 1 of ‘rte_strsplit’ discards ‘const’ qualifier from pointer target type [enabled by default]
         MAX_LOOKUP_ENTRIES, ',');
         ^
In file included from /opt/dpdk-18.08/x86_64-native-linuxapp-gcc/include/rte_acl_osdep.h:45:0,
                 from /opt/dpdk-18.08/x86_64-native-linuxapp-gcc/include/rte_acl.h:14,
                 from /opt/upgw/daemon/nts/nts_acl.c:16:
/opt/dpdk-18.08/x86_64-native-linuxapp-gcc/include/rte_string_fns.h:47:1: note: expected ‘char *’ but argument is of type ‘const char *’
 rte_strsplit(char *string, int stringlen,
 ^

81、/* warning: passing argument 1 of ‘rte_strsplit’ discards ‘const’ qualifier from pointer target type */
原因:同63。
修改方法:因为rte_strsplit是dpdk库函数,不能做修改,所以将传入参数的类型修改为非const。

/opt/upgw/daemon/nts/nts_acl.c:147:13: warning: unused variable ‘i’ [-Wunused-variable]
     uint8_t i, pairs_cnt;
             ^

82、/* warning: unused variable ‘i’ */
原因:同2。
修改方法:同2。

/opt/upgw/daemon/nts/nts_acl.c: In function ‘nes_database_parse_entry’:
/opt/upgw/daemon/nts/nts_acl.c:170:9: warning: passing argument 1 of ‘rte_strsplit’ discards ‘const’ qualifier from pointer target type [enabled by default]
         MAX_LOOKUP_ENTRIES, ';');
         ^
In file included from /opt/dpdk-18.08/x86_64-native-linuxapp-gcc/include/rte_acl_osdep.h:45:0,
                 from /opt/dpdk-18.08/x86_64-native-linuxapp-gcc/include/rte_acl.h:14,
                 from /opt/upgw/daemon/nts/nts_acl.c:16:
/opt/dpdk-18.08/x86_64-native-linuxapp-gcc/include/rte_string_fns.h:47:1: note: expected ‘char *’ but argument is of type ‘const char *’
 rte_strsplit(char *string, int stringlen,
 ^

83、/* warning: passing argument 1 of ‘rte_strsplit’ discards ‘const’ qualifier from pointer target type */
原因:同63。
修改方法:因为rte_strsplit是dpdk库函数,不能做修改,所以将传入参数的类型修改为非const。

/opt/upgw/daemon/nts/nts_acl.c:174:9: warning: passing argument 1 of ‘strlen’ from incompatible pointer type [enabled by default]
         strip(entry_lookup_data, strlen(&addr_rule_pairs[1]));
         ^
In file included from /opt/dpdk-18.08/x86_64-native-linuxapp-gcc/include/rte_acl_osdep.h:19:0,
                 from /opt/dpdk-18.08/x86_64-native-linuxapp-gcc/include/rte_acl.h:14,
                 from /opt/upgw/daemon/nts/nts_acl.c:16:
/usr/include/string.h:395:15: note: expected ‘const char *’ but argument is of type ‘char **’
 extern size_t strlen (const char *__s)
               ^

84、/* warning: passing argument 1 of ‘strlen’ from incompatible pointer type */
原因:同63。
修改方法:同63。

/opt/upgw/daemon/nts/nts_acl.c:167:13: warning: unused variable ‘i’ [-Wunused-variable]
     uint8_t i, pairs_cnt;
             ^

85、/* warning: unused variable ‘i’ */
原因:同2。
修改方法:同2。

/opt/upgw/daemon/nts/nts_acl.c: In function ‘nts_acl_lookup_init’:
/opt/upgw/daemon/nts/nts_acl.c:209:5: warning: implicit declaration of function ‘nts_acl_restore_dataplane_entries’ [-Wimplicit-function-declaration]
     if (NES_SUCCESS != nts_acl_restore_dataplane_entries(lookup_ctx)) {
     ^
/opt/upgw/daemon/nts/nts_acl.c:209:5: warning: nested extern declaration of ‘nts_acl_restore_dataplane_entries’ [-Wnested-externs]

86、/* warning: implicit declaration of function ‘nts_acl_restore_dataplane_entries’ */
原因:同35。
修改方法:同35。

/opt/upgw/daemon/nts/nts_acl.c: At top level:
/opt/upgw/daemon/nts/nts_acl.c:591:5: warning: no previous prototype for ‘nts_acl_restore_dataplane_entries’ [-Wmissing-prototypes]
 int nts_acl_restore_dataplane_entries(nes_acl_ctx_t* lookup_ctx) {
     ^

87、/* warning: no previous prototype for ‘nts_acl_restore_dataplane_entries’ */
原因:同1。
修改方法:加static修饰。

/opt/upgw/daemon/nts/nts_acl.c: In function ‘nts_acl_restore_dataplane_entries’:
/opt/upgw/daemon/nts/nts_acl.c:667:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(i = 0; i <= rule_cnt-1; i++){
                      ^
88、/* warning: comparison between signed and unsigned integer expressions */
原因:同16。
修改方法:修改i的变量类型。

/opt/upgw/daemon/nts/nts_acl.c:698:13: warning: implicit declaration of function ‘nes_uuid_lookup_entry_get’ [-Wimplicit-function-declaration]
             if (NES_SUCCESS == nes_uuid_lookup_entry_get(rules[i].uuid, &lookup_entry_data))
             ^
/opt/upgw/daemon/nts/nts_acl.c:698:13: warning: nested extern declaration of ‘nes_uuid_lookup_entry_get’ [-Wnested-externs]

89、/* warning: implicit declaration of function ‘nes_uuid_lookup_entry_get’ */
原因:同35。
修改方法:同35。

/opt/upgw/daemon/nts/nts_acl.c:597:10: warning: unused variable ‘route_rule_uuid’ [-Wunused-variable]
     char route_rule_uuid[UUID_STR_LEN];
          ^
/opt/upgw/daemon/nts/nts_acl.c:594:17: warning: unused variable ‘section_name’ [-Wunused-variable]
     static char section_name[] = TRAFFIC_RULE_ENTRY;
                 ^
/opt/upgw/daemon/nts/nts_acl.c:592:31: warning: unused variable ‘route_entries’ [-Wunused-variable]
     struct rte_cfgfile_entry  route_entries[MAX_LOOKUPS_PER_VM];
                               ^

90、/* warning: unused variable ‘route_rule_uuid’ */
原因:同2。
修改方法:同2。

In file included from /opt/upgw/daemon/nts/nts_acl.c:28:0:
/opt/upgw/daemon/nts/nts_acl.c: At top level:
/opt/upgw//libs/libnes_redis/libnes_redis.h:12:13: warning: ‘REDIS_HOST’ defined but not used [-Wunused-variable]
 static char REDIS_HOST[50];
             ^
/opt/upgw//libs/libnes_redis/libnes_redis.h:13:17: warning: ‘REDIS_PORT’ defined but not used [-Wunused-variable]
 static uint16_t REDIS_PORT;
                 ^
/opt/upgw/daemon/nts/nts_acl.c:143:12: warning: ‘nes_routefile_parse_entryname’ defined but not used [-Wunused-function]
 static int nes_routefile_parse_entryname(const char *entry_name, char *uuid_str,
            ^
/opt/upgw/daemon/nts/nts_acl.c:496:1: warning: ‘nts_acl_add_single_dataplane_entry’ defined but not used [-Wunused-function]
 nts_acl_add_single_dataplane_entry(nes_acl_ctx_t* lookup_ctx, char *port_name, char *tx_ring_name)
 ^

91、/* warning: ‘REDIS_HOST’ defined but not used */
原因:变量定义后未被使用。
修改方法:删除此变量。

  CC nts/nts_acl_cfg.o
/opt/upgw/daemon/nts/nts_acl_cfg.c:165:1: warning: no previous prototype for ‘nes_acl_ether_to_str’ [-Wmissing-prototypes]
 nes_acl_ether_to_str(char *mac, const struct ether_addr *ether_address) {
 ^
/opt/upgw/daemon/nts/nts_acl_cfg.c: In function ‘nts_acl_cfg_lookup_prepare’:
/opt/upgw/daemon/nts/nts_acl_cfg.c:551:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             for (j = 0; j < strlen(value); j++) {
                           ^

92、/* warning: no previous prototype for ‘nes_acl_ether_to_str’ */
原因:同16。
修改方法:修改i为size_t类型。

  CC dns/nes_dns_hosts.o
  CC dns/nes_dns_config.o
  CC dns/nes_dns_tools.o
  CC dns/nes_dns.o
  CC nes_arp.o
  CC nes_latency.o
  CC io/nes_io.o
  CC io/nes_mac_lookup.o
  CC io/nes_dev_eth.o
/opt/upgw/daemon/io/nes_dev_eth.c: In function ‘recv_eth’:
/opt/upgw/daemon/io/nes_dev_eth.c:208:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     if (RTE_LOG_DEBUG <= rte_log_get_level(logtype_nes)) {
                       ^
/opt/upgw/daemon/io/nes_dev_eth.c:212:13: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 5 has type ‘uint64_t’ [-Wformat=]
             NES_LOG(DEBUG, "thread:nes_io, module:recv, portname:%s, index:%llu", self->name, self->rx_pkts[i]->udata64);
             ^
/opt/upgw/daemon/io/nes_dev_eth.c: In function ‘send_eth’:
/opt/upgw/daemon/io/nes_dev_eth.c:241:35: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
                 if (RTE_LOG_DEBUG <= rte_log_get_level(logtype_nes)) {
                                   ^
/opt/upgw/daemon/io/nes_dev_eth.c:243:26: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 6 has type ‘uint64_t’ [-Wformat=]
                          NES_LOG(DEBUG, "thread:nes_io, module:send remaining, from portname:%s, to portname:%s, index:%llu, from ring:%s", devices_tab[self->tx_buffer[j]->port].device->name, self->name, self->tx_buffer[j]->udata64, tx_ring->ring->name);
                          ^
/opt/upgw/daemon/io/nes_dev_eth.c:265:31: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             if (RTE_LOG_DEBUG <= rte_log_get_level(logtype_nes)) {
                               ^
/opt/upgw/daemon/io/nes_dev_eth.c:267:21: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 6 has type ‘uint64_t’ [-Wformat=]
                     NES_LOG(DEBUG, "thread:nes_io, module:send less, from portname:%s, to portname:%s, index:%llu, from ring:%s", devices_tab[buf[j]->port].device->name, self->name, buf[j]->udata64, tx_ring->ring->name);
                     ^
/opt/upgw/daemon/io/nes_dev_eth.c:272:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if (RTE_LOG_DEBUG <= rte_log_get_level(logtype_nes)) {
                           ^
/opt/upgw/daemon/io/nes_dev_eth.c:274:17: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 6 has type ‘uint64_t’ [-Wformat=]
                 NES_LOG(DEBUG, "thread:nes_io, module:send, from portname:%s, to portname:%s, index:%llu, from ring:%s", devices_tab[buf[j]->port].device->name, self->name, buf[j]->udata64, tx_ring->ring->name);
                 ^
/opt/upgw/daemon/io/nes_dev_eth.c: In function ‘send_eth_mtu’:
/opt/upgw/daemon/io/nes_dev_eth.c:304:35: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
                 if (RTE_LOG_DEBUG <= rte_log_get_level(logtype_nes)) {
                                   ^
/opt/upgw/daemon/io/nes_dev_eth.c:306:25: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 6 has type ‘uint64_t’ [-Wformat=]
                         NES_LOG(DEBUG, "thread:nes_io, module:send mtu remaining, from portname:%s, to portname:%s, index:%llu, from ring:%s", devices_tab[self->rx_pkts[i]->port].device->name, self->name, self->rx_pkts[i]->udata64, tx_ring->ring->name);
                         ^
/opt/upgw/daemon/io/nes_dev_eth.c:403:35: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
                 if (RTE_LOG_DEBUG <= rte_log_get_level(logtype_nes)) {
                                   ^
/opt/upgw/daemon/io/nes_dev_eth.c:405:25: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 6 has type ‘uint64_t’ [-Wformat=]
                         NES_LOG(DEBUG, "thread:nes_io, module:send mtu less, from portname:%s, to portname:%s, index:%llu, from ring:%s", devices_tab[buf_to_send[i]->port].device->name, self->name, buf_to_send[i]->udata64, tx_ring->ring->name);
                         ^
/opt/upgw/daemon/io/nes_dev_eth.c:410:31: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             if (RTE_LOG_DEBUG <= rte_log_get_level(logtype_nes)) {
                               ^
/opt/upgw/daemon/io/nes_dev_eth.c:412:21: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 6 has type ‘uint64_t’ [-Wformat=]
                     NES_LOG(DEBUG, "thread:nes_io, module:send mtu, to portname:%s, from portname:%s, index:%llu, from ring:%s", devices_tab[buf_to_send[i]->port].device->name, self->name, buf_to_send[i]->udata64, tx_ring->ring->name);
                     ^
  CC io/nes_dev_vhost.o
  CC io/nes_dev_kni.o
  CC io/nes_dev_port.o
/opt/upgw/daemon/io/nes_dev_port.c: In function ‘scatter_eth_packets’:
/opt/upgw/daemon/io/nes_dev_port.c:216:31: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             if (RTE_LOG_DEBUG <= rte_log_get_level(logtype_nes)) {
                               ^
/opt/upgw/daemon/io/nes_dev_port.c:218:21: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 5 has type ‘uint64_t’ [-Wformat=]
                     NES_LOG(DEBUG, "thread:nes_io, module:scatter, portname:%s, index:%llu, traffic-direction:FROM UPSTR, proto-type:NO ETHER_TYPE_IPv4, to_ring:%s", self->name, self->rx_pkts[i]->udata64, ring->ring->name);
                     ^
/opt/upgw/daemon/io/nes_dev_port.c:220:21: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 5 has type ‘uint64_t’ [-Wformat=]
                     NES_LOG(DEBUG, "thread:nes_io, module:scatter, portname:%s, index:%llu, traffic-direction:FROM DWSTR, proto-type:NO ETHER_TYPE_IPv4, to_ring:%s", self->name, self->rx_pkts[i]->udata64, ring->ring->name);
                     ^
/opt/upgw/daemon/io/nes_dev_port.c:264:39: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
                     if (RTE_LOG_DEBUG <= rte_log_get_level(logtype_nes)) {
                                       ^
/opt/upgw/daemon/io/nes_dev_port.c:266:29: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 5 has type ‘uint64_t’ [-Wformat=]
                             NES_LOG(DEBUG, "thread:nes_io, module:scatter, portname:%s, index:%llu, srcip:%s, dstip:%s, traffic-direction:FROM UPSTR, proto-type:SCTP, to_ring:%s", self->name, self->rx_pkts[i]->udata64, src_ip, dst_ip, ring->ring->name);
                             ^
/opt/upgw/daemon/io/nes_dev_port.c:268:29: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 5 has type ‘uint64_t’ [-Wformat=]
                             NES_LOG(DEBUG, "thread:nes_io, module:scatter, portname:%s, index:%llu, srcip:%s, dstip:%s, traffic-direction:FROM DWSTR, proto-type:SCTP, to_ring:%s", self->name, self->rx_pkts[i]->udata64, src_ip, dst_ip, ring->ring->name);
                             ^
/opt/upgw/daemon/io/nes_dev_port.c:274:21: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 5 has type ‘uint64_t’ [-Wformat=]
                     NES_LOG(DEBUG, "thread:nes_io, module:scatter, portname:%s, index:%llu, srcip:%s, dstip:%s, traffic-direction:FROM UPSTR, proto-type:SCTP, to_ring:%s", self->name, self->rx_pkts[i]->udata64, src_ip, dst_ip, ring->ring->name);
                     ^
/opt/upgw/daemon/io/nes_dev_port.c:278:21: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 5 has type ‘uint64_t’ [-Wformat=]
                     NES_LOG(DEBUG, "thread:nes_io, module:scatter, portname:%s, index:%llu, srcip:%s, dstip:%s, traffic-direction:FROM DWSTR, proto-type:SCTP, to_ring:%s", self->name, self->rx_pkts[i]->udata64, src_ip, dst_ip, ring->ring->name);
                     ^
/opt/upgw/daemon/io/nes_dev_port.c:290:43: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
                         if (RTE_LOG_DEBUG <= rte_log_get_level(logtype_nes)) {
                                           ^
/opt/upgw/daemon/io/nes_dev_port.c:292:33: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 5 has type ‘uint64_t’ [-Wformat=]
                                 NES_LOG(DEBUG, "thread:nes_io, module:scatter, portname:%s, index:%llu, srcip:%s, dstip:%s, traffic-direction:FROM UPSTR, proto-type:IP, to_ring:%s", self->name, self->rx_pkts[i]->udata64, src_ip, dst_ip, ring->ring->name);
                                 ^
/opt/upgw/daemon/io/nes_dev_port.c:294:33: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 5 has type ‘uint64_t’ [-Wformat=]
                                 NES_LOG(DEBUG, "thread:nes_io, module:scatter, portname:%s, index:%llu, srcip:%s, dstip:%s, traffic-direction:FROM DWSTR, proto-type:IP, to_ring:%s", self->name, self->rx_pkts[i]->udata64, src_ip, dst_ip, ring->ring->name);
                                 ^
/opt/upgw/daemon/io/nes_dev_port.c:302:25: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 5 has type ‘uint64_t’ [-Wformat=]
                         NES_LOG(DEBUG, "thread:nes_io, module:scatter, portname:%s, index:%llu, srcip:%s, dstip:%s, traffic-direction:FROM UPSTR, proto-type:IP, to_ring:%s", self->name, self->rx_pkts[i]->udata64, src_ip, dst_ip, ring->ring->name);
                         ^
/opt/upgw/daemon/io/nes_dev_port.c:308:25: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 5 has type ‘uint64_t’ [-Wformat=]
                         NES_LOG(DEBUG, "thread:nes_io, module:scatter, portname:%s, index:%llu, srcip:%s, dstip:%s, traffic-direction:FROM DWSTR, proto-type:IP, to_ring:%s", self->name, self->rx_pkts[i]->udata64, src_ip, dst_ip, ring->ring->name);
                         ^
/opt/upgw/daemon/io/nes_dev_port.c:313:39: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
                     if (RTE_LOG_DEBUG <= rte_log_get_level(logtype_nes)) {
                                       ^
/opt/upgw/daemon/io/nes_dev_port.c:315:29: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 5 has type ‘uint64_t’ [-Wformat=]
                             NES_LOG(DEBUG, "thread:nes_io, module:scatter, portname:%s, index:%llu, srcip:%s, dstip:%s, traffic-direction:FROM UPSTR, proto-type:LTE WITHOUT UDP, to_ring:%s", self->name, self->rx_pkts[i]->udata64, src_ip, dst_ip, ring->ring->name);
                             ^
/opt/upgw/daemon/io/nes_dev_port.c:317:29: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 5 has type ‘uint64_t’ [-Wformat=]
                             NES_LOG(DEBUG, "thread:nes_io, module:scatter, portname:%s, index:%llu, srcip:%s, dstip:%s, traffic-direction:FROM DWSTR, proto-type:LTE WITHOUT UDP, to_ring:%s", self->name, self->rx_pkts[i]->udata64, src_ip, dst_ip, ring->ring->name);
                             ^
/opt/upgw/daemon/io/nes_dev_port.c:342:39: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
                     if (RTE_LOG_DEBUG <= rte_log_get_level(logtype_nes)) {
                                       ^
/opt/upgw/daemon/io/nes_dev_port.c:344:29: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 5 has type ‘uint64_t’ [-Wformat=]
                             NES_LOG(DEBUG, "thread:nes_io, module:scatter, portname:%s, index:%llu, srcip:%s, dstip:%s, traffic-direction:FROM UPSTR, proto-type:GTPU, to_ring:%s", self->name, self->rx_pkts[i]->udata64, src_ip, dst_ip, ring->ring->name);
                             ^
/opt/upgw/daemon/io/nes_dev_port.c:346:29: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 5 has type ‘uint64_t’ [-Wformat=]
                             NES_LOG(DEBUG, "thread:nes_io, module:scatter, portname:%s, index:%llu, srcip:%s, dstip:%s, traffic-direction:FROM DWSTR, proto-type:GTPU, to_ring:%s", self->name, self->rx_pkts[i]->udata64, src_ip, dst_ip, ring->ring->name);
                             ^
/opt/upgw/daemon/io/nes_dev_port.c:352:21: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 5 has type ‘uint64_t’ [-Wformat=]
                     NES_LOG(DEBUG, "thread:nes_io, module:scatter, portname:%s, index:%llu, srcip:%s, dstip:%s, traffic-direction:FROM UPSTR, proto-type:GTPU, to_ring:%s", self->name, self->rx_pkts[i]->udata64, src_ip, dst_ip, ring->ring->name);
                     ^
/opt/upgw/daemon/io/nes_dev_port.c:356:21: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 5 has type ‘uint64_t’ [-Wformat=]
                     NES_LOG(DEBUG, "thread:nes_io, module:scatter, portname:%s, index:%llu, srcip:%s, dstip:%s, traffic-direction:FROM DWSTR, proto-type:GTPU, to_ring:%s", self->name, self->rx_pkts[i]->udata64, src_ip, dst_ip, ring->ring->name);
                     ^
/opt/upgw/daemon/io/nes_dev_port.c:364:39: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
                     if (RTE_LOG_DEBUG <= rte_log_get_level(logtype_nes)) {
                                       ^
/opt/upgw/daemon/io/nes_dev_port.c:366:29: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 5 has type ‘uint64_t’ [-Wformat=]
                             NES_LOG(DEBUG, "thread:nes_io, module:scatter, portname:%s, index:%llu, srcip:%s, dstip:%s, traffic-direction:FROM UPSTR, proto-type:GTPC, to_ring:%s", self->name, self->rx_pkts[i]->udata64, src_ip, dst_ip, ring->ring->name);
                             ^
/opt/upgw/daemon/io/nes_dev_port.c:368:29: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 5 has type ‘uint64_t’ [-Wformat=]
                             NES_LOG(DEBUG, "thread:nes_io, module:scatter, portname:%s, index:%llu, srcip:%s, dstip:%s, traffic-direction:FROM DWSTR, proto-type:GTPC, to_ring:%s", self->name, self->rx_pkts[i]->udata64, src_ip, dst_ip, ring->ring->name);
                             ^
/opt/upgw/daemon/io/nes_dev_port.c:374:21: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 5 has type ‘uint64_t’ [-Wformat=]
                     NES_LOG(DEBUG, "thread:nes_io, module:scatter, portname:%s, index:%llu, srcip:%s, dstip:%s, traffic-direction:FROM UPSTR, proto-type:GTPC, to_ring:%s", self->name, self->rx_pkts[i]->udata64, src_ip, dst_ip, ring->ring->name);
                     ^
/opt/upgw/daemon/io/nes_dev_port.c:378:21: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 5 has type ‘uint64_t’ [-Wformat=]
                     NES_LOG(DEBUG, "thread:nes_io, module:scatter, portname:%s, index:%llu, srcip:%s, dstip:%s, traffic-direction:FROM DWSTR, proto-type:GTPC, to_ring:%s", self->name, self->rx_pkts[i]->udata64, src_ip, dst_ip, ring->ring->name);
                     ^
/opt/upgw/daemon/io/nes_dev_port.c:388:43: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
                         if (RTE_LOG_DEBUG <= rte_log_get_level(logtype_nes)) {
                                           ^
/opt/upgw/daemon/io/nes_dev_port.c:390:33: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 5 has type ‘uint64_t’ [-Wformat=]
                                 NES_LOG(DEBUG, "thread:nes_io, module:scatter, portname:%s, index:%llu, srcip:%s, dstip:%s, traffic-direction:FROM UPSTR, proto-type:IP, to_ring:%s", self->name, self->rx_pkts[i]->udata64, src_ip, dst_ip, ring->ring->name);
                                 ^
/opt/upgw/daemon/io/nes_dev_port.c:392:33: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 5 has type ‘uint64_t’ [-Wformat=]
                                 NES_LOG(DEBUG, "thread:nes_io, module:scatter, portname:%s, index:%llu, srcip:%s, dstip:%s, traffic-direction:FROM DWSTR, proto-type:IP, to_ring:%s", self->name, self->rx_pkts[i]->udata64, src_ip, dst_ip, ring->ring->name);
                                 ^
/opt/upgw/daemon/io/nes_dev_port.c:400:25: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 5 has type ‘uint64_t’ [-Wformat=]
                         NES_LOG(DEBUG, "thread:nes_io, module:scatter, portname:%s, index:%llu, srcip:%s, dstip:%s, traffic-direction:FROM UPSTR, proto-type:IP, to_ring:%s", self->name, self->rx_pkts[i]->udata64, src_ip, dst_ip, ring->ring->name);
                         ^
/opt/upgw/daemon/io/nes_dev_port.c:406:25: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 5 has type ‘uint64_t’ [-Wformat=]
                         NES_LOG(DEBUG, "thread:nes_io, module:scatter, portname:%s, index:%llu, srcip:%s, dstip:%s, traffic-direction:FROM DWSTR, proto-type:IP, to_ring:%s", self->name, self->rx_pkts[i]->udata64, src_ip, dst_ip, ring->ring->name);
                         ^
/opt/upgw/daemon/io/nes_dev_port.c:411:39: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
                     if (RTE_LOG_DEBUG <= rte_log_get_level(logtype_nes)) {
                                       ^
/opt/upgw/daemon/io/nes_dev_port.c:413:29: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 5 has type ‘uint64_t’ [-Wformat=]
                             NES_LOG(DEBUG, "thread:nes_io, module:scatter, portname:%s, index:%llu, srcip:%s, dstip:%s, traffic-direction:FROM UPSTR, proto-type:LTE WITH UDP, to_ring:%s", self->name, self->rx_pkts[i]->udata64, src_ip, dst_ip, ring->ring->name);
                             ^
/opt/upgw/daemon/io/nes_dev_port.c:415:29: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 5 has type ‘uint64_t’ [-Wformat=]
                             NES_LOG(DEBUG, "thread:nes_io, module:scatter, portname:%s, index:%llu, srcip:%s, dstip:%s, traffic-direction:FROM DWSTR, proto-type:LTE WITH UDP, to_ring:%s", self->name, self->rx_pkts[i]->udata64, src_ip, dst_ip, ring->ring->name);
                             ^
/opt/upgw/daemon/io/nes_dev_port.c:426:35: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
                 if (RTE_LOG_DEBUG <= rte_log_get_level(logtype_nes)) {
                                   ^
/opt/upgw/daemon/io/nes_dev_port.c:428:25: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 5 has type ‘uint64_t’ [-Wformat=]
                         NES_LOG(DEBUG, "thread:nes_io, module:scatter, portname:%s, index:%llu, srcip:%s, dstip:%s, traffic-direction:FROM UPSTR, proto-type:IP, to_ring:%s", self->name, self->rx_pkts[i]->udata64, src_ip, dst_ip, ring->ring->name);
                         ^
/opt/upgw/daemon/io/nes_dev_port.c:430:25: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 5 has type ‘uint64_t’ [-Wformat=]
                         NES_LOG(DEBUG, "thread:nes_io, module:scatter, portname:%s, index:%llu, srcip:%s, dstip:%s, traffic-direction:FROM DWSTR, proto-type:IP, to_ring:%s", self->name, self->rx_pkts[i]->udata64, src_ip, dst_ip, ring->ring->name);
                         ^
/opt/upgw/daemon/io/nes_dev_port.c:436:17: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 5 has type ‘uint64_t’ [-Wformat=]
                 NES_LOG(DEBUG, "thread:nes_io, module:scatter, portname:%s, index:%llu, srcip:%s, dstip:%s, traffic-direction:FROM UPSTR, proto-type:IP, to_ring:%s", self->name, self->rx_pkts[i]->udata64, src_ip, dst_ip, ring->ring->name);
                 ^
/opt/upgw/daemon/io/nes_dev_port.c:440:17: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 5 has type ‘uint64_t’ [-Wformat=]
                 NES_LOG(DEBUG, "thread:nes_io, module:scatter, portname:%s, index:%llu, srcip:%s, dstip:%s, traffic-direction:FROM DWSTR, proto-type:IP, to_ring:%s", self->name, self->rx_pkts[i]->udata64, src_ip, dst_ip, ring->ring->name);
                 ^
/opt/upgw/daemon/io/nes_dev_port.c: In function ‘scatter_eth_lbp’:
/opt/upgw/daemon/io/nes_dev_port.c:511:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if (RTE_LOG_DEBUG <= rte_log_get_level(logtype_nes)) {
                           ^
/opt/upgw/daemon/io/nes_dev_port.c:513:17: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 5 has type ‘uint64_t’ [-Wformat=]
                 NES_LOG(DEBUG, "thread:nes_io, module:scatter less, portname:%s, index:%llu, traffic-direction:FROM LBP, to_ring:%s", self->name, self->rx_pkts[j]->udata64, rx_ring->ring->name);
                 ^
/opt/upgw/daemon/io/nes_dev_port.c:523:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     if (RTE_LOG_DEBUG <= rte_log_get_level(logtype_nes)) {
                       ^
/opt/upgw/daemon/io/nes_dev_port.c:525:13: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 5 has type ‘uint64_t’ [-Wformat=]
             NES_LOG(DEBUG, "thread:nes_io, module:scatter, portname:%s, index:%llu, traffic-direction:FROM LBP, to_ring:%s", self->name, self->rx_pkts[j]->udata64, rx_ring->ring->name);
             ^

93、/* warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 5 has type ‘uint64_t’ */
原因:同32。
修改方法:同32。

94、/* warning: comparison between signed and unsigned integer expressions */
原因:同16。
修改方法:将RTE_LOG_DEBUG强转为int类型。

  CC io/nes_dev_addons.o
  CC nts/nts_domainame.o
/opt/upgw/daemon/nts/nts_domainame.c:10:5: warning: no previous prototype for ‘nes_dns_pkt_key_lookup_init’ [-Wmissing-prototypes]
 int nes_dns_pkt_key_lookup_init(void)
     ^
/opt/upgw/daemon/nts/nts_domainame.c:28:5: warning: no previous prototype for ‘nes_uuid_domainame_lookup_init’ [-Wmissing-prototypes]
 int nes_uuid_domainame_lookup_init(void)
     ^

95、/* warning: no previous prototype for ‘nes_dns_pkt_key_lookup_init’ */
原因:同1。
修改方法:加static修饰。

/opt/upgw/daemon/nts/nts_domainame.c:124:5: warning: no previous prototype for ‘nes_domainname_lookup_entry_get’ [-Wmissing-prototypes]
 int nes_domainname_lookup_entry_get(const char * name,  struct nes_domainame_entry_s **domainame_entry)
     ^
/opt/upgw/daemon/nts/nts_domainame.c:168:5: warning: no previous prototype for ‘prepare_dns_rule_entries’ [-Wmissing-prototypes]
 int prepare_dns_rule_entries(const char *lookup_str,
     ^

96、/* warning: no previous prototype for ‘nes_domainname_lookup_entry_get’ */
原因:同1。
修改方法:在对应的.h里面声明。

/opt/upgw/daemon/nts/nts_domainame.c: In function ‘nes_domainame_entry_add’:
/opt/upgw/daemon/nts/nts_domainame.c:272:5: warning: passing argument 3 of ‘nes_lookup_entry_find’ from incompatible pointer type [enabled by default]
     if(NES_SUCCESS == nes_lookup_entry_find(&nes_uuid_domainame_lookup_table, uuid, &uuid_domainame_entry_c)){
     ^
In file included from /opt/upgw//daemon/nts/nts_lookup.h:19:0,
                 from /opt/upgw//daemon/nes_ring.h:19,
                 from /opt/upgw/daemon/nts/nts_domainame.h:2,
                 from /opt/upgw/daemon/nts/nts_domainame.c:5:
/opt/upgw//libs/libnes_lookup/libnes_lookup.h:78:6: note: expected ‘void **’ but argument is of type ‘struct nes_uuid_domainame_entry_s **’
 int  nes_lookup_entry_find(nes_lookup_table_t *lookup, const void *key, void **pentry);
      ^
/opt/upgw/daemon/nts/nts_domainame.c:279:5: warning: passing argument 3 of ‘nes_lookup_entry_get’ from incompatible pointer type [enabled by default]
     if (NES_SUCCESS == nes_lookup_entry_get(&nes_uuid_domainame_lookup_table, uuid, &uuid_domainame_entry_c)) {
     ^
In file included from /opt/upgw//daemon/nts/nts_lookup.h:19:0,
                 from /opt/upgw//daemon/nes_ring.h:19,
                 from /opt/upgw/daemon/nts/nts_domainame.h:2,
                 from /opt/upgw/daemon/nts/nts_domainame.c:5:
/opt/upgw//libs/libnes_lookup/libnes_lookup.h:69:6: note: expected ‘void **’ but argument is of type ‘struct nes_uuid_domainame_entry_s **’
 int  nes_lookup_entry_get(nes_lookup_table_t *lookup, const void *key, void **pentry);
      ^
/opt/upgw/daemon/nts/nts_domainame.c:294:5: warning: passing argument 3 of ‘nes_lookup_entry_find’ from incompatible pointer type [enabled by default]
     if (NES_SUCCESS == nes_lookup_entry_find(&nes_domainame_lookup_table, domainame_entry->domain_name, &domainame_entry_c)) {
     ^
In file included from /opt/upgw//daemon/nts/nts_lookup.h:19:0,
                 from /opt/upgw//daemon/nes_ring.h:19,
                 from /opt/upgw/daemon/nts/nts_domainame.h:2,
                 from /opt/upgw/daemon/nts/nts_domainame.c:5:
/opt/upgw//libs/libnes_lookup/libnes_lookup.h:78:6: note: expected ‘void **’ but argument is of type ‘struct nes_domainame_entry_s **’
 int  nes_lookup_entry_find(nes_lookup_table_t *lookup, const void *key, void **pentry);
      ^
/opt/upgw/daemon/nts/nts_domainame.c:299:5: warning: passing argument 3 of ‘nes_lookup_entry_get’ from incompatible pointer type [enabled by default]
     else if (NES_SUCCESS == nes_lookup_entry_get(&nes_domainame_lookup_table, domainame_entry->domain_name, &domainame_entry_c)) {
     ^
In file included from /opt/upgw//daemon/nts/nts_lookup.h:19:0,
                 from /opt/upgw//daemon/nes_ring.h:19,
                 from /opt/upgw/daemon/nts/nts_domainame.h:2,
                 from /opt/upgw/daemon/nts/nts_domainame.c:5:
/opt/upgw//libs/libnes_lookup/libnes_lookup.h:69:6: note: expected ‘void **’ but argument is of type ‘struct nes_domainame_entry_s **’
 int  nes_lookup_entry_get(nes_lookup_table_t *lookup, const void *key, void **pentry);
      ^
/opt/upgw/daemon/nts/nts_domainame.c:269:10: warning: unused variable ‘domain_name_ori’ [-Wunused-variable]
     char domain_name_ori[DOMAIN_NAME_MAX_LEN + 1] = {0};
          ^
/opt/upgw/daemon/nts/nts_domainame.c: In function ‘nes_domainame_entry_del’:
/opt/upgw/daemon/nts/nts_domainame.c:321:5: warning: passing argument 3 of ‘nes_lookup_entry_find’ from incompatible pointer type [enabled by default]
     if(NES_SUCCESS == nes_lookup_entry_find(&nes_uuid_domainame_lookup_table, uuid, &uuid_domainame_entry_c)){
     ^
In file included from /opt/upgw//daemon/nts/nts_lookup.h:19:0,
                 from /opt/upgw//daemon/nes_ring.h:19,
                 from /opt/upgw/daemon/nts/nts_domainame.h:2,
                 from /opt/upgw/daemon/nts/nts_domainame.c:5:
/opt/upgw//libs/libnes_lookup/libnes_lookup.h:78:6: note: expected ‘void **’ but argument is of type ‘struct nes_uuid_domainame_entry_s **’
 int  nes_lookup_entry_find(nes_lookup_table_t *lookup, const void *key, void **pentry);
      ^
/opt/upgw/daemon/nts/nts_domainame.c:341:5: warning: passing argument 3 of ‘nes_lookup_entry_find’ from incompatible pointer type [enabled by default]
     if(NES_SUCCESS == nes_lookup_entry_find(&nes_domainame_lookup_table, domain_name, &current_entry)){
     ^
In file included from /opt/upgw//daemon/nts/nts_lookup.h:19:0,
                 from /opt/upgw//daemon/nes_ring.h:19,
                 from /opt/upgw/daemon/nts/nts_domainame.h:2,
                 from /opt/upgw/daemon/nts/nts_domainame.c:5:
/opt/upgw//libs/libnes_lookup/libnes_lookup.h:78:6: note: expected ‘void **’ but argument is of type ‘struct nes_domainame_entry_s **’
 int  nes_lookup_entry_find(nes_lookup_table_t *lookup, const void *key, void **pentry);
      ^
/opt/upgw/daemon/nts/nts_domainame.c:340:14: warning: unused variable ‘relate_cnt’ [-Wunused-variable]
     uint32_t relate_cnt = 0;
              ^
/opt/upgw/daemon/nts/nts_domainame.c: In function ‘nes_domainame_entry_show’:
/opt/upgw/daemon/nts/nts_domainame.c:366:5: warning: passing argument 3 of ‘nes_lookup_entry_find’ from incompatible pointer type [enabled by default]
     if(NES_SUCCESS == nes_lookup_entry_find(&nes_uuid_domainame_lookup_table, uuid, &uuid_domainame_entry_c)){
     ^
In file included from /opt/upgw//daemon/nts/nts_lookup.h:19:0,
                 from /opt/upgw//daemon/nes_ring.h:19,
                 from /opt/upgw/daemon/nts/nts_domainame.h:2,
                 from /opt/upgw/daemon/nts/nts_domainame.c:5:
/opt/upgw//libs/libnes_lookup/libnes_lookup.h:78:6: note: expected ‘void **’ but argument is of type ‘struct nes_uuid_domainame_entry_s **’
 int  nes_lookup_entry_find(nes_lookup_table_t *lookup, const void *key, void **pentry);
      ^
/opt/upgw/daemon/nts/nts_domainame.c:378:5: warning: passing argument 3 of ‘nes_lookup_entry_find’ from incompatible pointer type [enabled by default]
     if (NES_SUCCESS == nes_lookup_entry_find(&nes_domainame_lookup_table, domain_name, &current_entry)) {
     ^
In file included from /opt/upgw//daemon/nts/nts_lookup.h:19:0,
                 from /opt/upgw//daemon/nes_ring.h:19,
                 from /opt/upgw/daemon/nts/nts_domainame.h:2,
                 from /opt/upgw/daemon/nts/nts_domainame.c:5:
/opt/upgw//libs/libnes_lookup/libnes_lookup.h:78:6: note: expected ‘void **’ but argument is of type ‘struct nes_domainame_entry_s **’
 int  nes_lookup_entry_find(nes_lookup_table_t *lookup, const void *key, void **pentry);
      ^
/opt/upgw/daemon/nts/nts_domainame.c:360:17: warning: unused variable ‘entry_cnt’ [-Wunused-variable]
     uint32_t i, entry_cnt = 0;
                 ^
/opt/upgw/daemon/nts/nts_domainame.c:360:14: warning: unused variable ‘i’ [-Wunused-variable]
     uint32_t i, entry_cnt = 0;
              ^

97、/* warning: passing argument 3 of ‘nes_lookup_entry_find’ from incompatible pointer type */
原因:定义参数和传入参数类型不一致。
修改方法:传参时强转为void **。

98、/* warning: unused variable ‘relate_cnt’ */
原因:同2。
修改方法:同2。

/opt/upgw/daemon/nts/nts_domainame.c:358:105: warning: unused parameter ‘domainame_entry’ [-Wunused-parameter]
 int nes_domainame_entry_show(char * uuid, nes_dns_data_t *nes_domainames, struct nes_domainame_entry_s *domainame_entry, uint32_t cnt)
                                                                                                         ^
/opt/upgw/daemon/nts/nts_domainame.c:358:131: warning: unused parameter ‘cnt’ [-Wunused-parameter]
 int nes_domainame_entry_show(char * uuid, nes_dns_data_t *nes_domainames, struct nes_domainame_entry_s *domainame_entry, uint32_t cnt)                                                            ^

99、/* warning: unused parameter ‘cnt’ */
原因:同60。
修改方法:删除该参数。

/opt/upgw/daemon/nts/nts_domainame.c: In function ‘nes_domainame_entry_list’:
/opt/upgw/daemon/nts/nts_domainame.c:402:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (j = 0; j <= nes_uuid_domainame_lookup_table.number_of_entries; j++) {
                   ^

100、/* warning: comparison between signed and unsigned integer expressions */
原因:同16。
修改方法:修改j的变量类型。

/opt/upgw/daemon/nts/nts_domainame.c:408:9: warning: passing argument 3 of ‘nes_lookup_entry_find’ from incompatible pointer type [enabled by default]
         if(NES_SUCCESS == nes_lookup_entry_find(&nes_domainame_lookup_table, uuid_domainame_entry_c->domain_name, &current_entry)){
         ^
In file included from /opt/upgw//daemon/nts/nts_lookup.h:19:0,
                 from /opt/upgw//daemon/nes_ring.h:19,
                 from /opt/upgw/daemon/nts/nts_domainame.h:2,
                 from /opt/upgw/daemon/nts/nts_domainame.c:5:
/opt/upgw//libs/libnes_lookup/libnes_lookup.h:78:6: note: expected ‘void **’ but argument is of type ‘struct nes_domainame_entry_s **’
 int  nes_lookup_entry_find(nes_lookup_table_t *lookup, const void *key, void **pentry);
      ^

101、/* warning: passing argument 3 of ‘nes_lookup_entry_find’ from incompatible pointer type */
原因:同97。
修改方法:同97。

/opt/upgw/daemon/nts/nts_domainame.c:415:5: warning: statement with no effect [-Wunused-value]
     *cnt == entry_cnt;
     ^

102、/* warning: statement with no effect */
原因:赋值号输错。
修改方法:改为*cnt = entry_cnt。

/opt/upgw/daemon/nts/nts_domainame.c: At top level:
/opt/upgw/daemon/nts/nts_domainame.c:442:5: warning: no previous prototype for ‘domainname_check’ [-Wmissing-prototypes]
 int domainname_check(char * domain_name, uint32_t *ip)
     ^

103、/* warning: no previous prototype for ‘domainname_check’ */
原因:同1。
修改方法:在对应的.h文件中声明。

/opt/upgw/daemon/nts/nts_domainame.c: In function ‘domainname_check’:
/opt/upgw/daemon/nts/nts_domainame.c:467:5: warning: passing argument 3 of ‘nes_lookup_entry_find’ from incompatible pointer type [enabled by default]
     if(NES_SUCCESS == nes_lookup_entry_find(&nes_domainame_lookup_table, domain_name_buf, &domainame_entry)){
     ^
In file included from /opt/upgw//daemon/nts/nts_lookup.h:19:0,
                 from /opt/upgw//daemon/nes_ring.h:19,
                 from /opt/upgw/daemon/nts/nts_domainame.h:2,
                 from /opt/upgw/daemon/nts/nts_domainame.c:5:
/opt/upgw//libs/libnes_lookup/libnes_lookup.h:78:6: note: expected ‘void **’ but argument is of type ‘struct nes_domainame_entry_s **’
 int  nes_lookup_entry_find(nes_lookup_table_t *lookup, const void *key, void **pentry);
      ^
/opt/upgw/daemon/nts/nts_domainame.c: In function ‘dns_pkt_key_add’:
/opt/upgw/daemon/nts/nts_domainame.c:485:5: warning: passing argument 3 of ‘nes_lookup_entry_get’ from incompatible pointer type [enabled by default]
     if(NES_SUCCESS == nes_lookup_entry_get(&dns_pkt_key_lookup_table,&dns_pkt_key->transaction_id, &dns_pkt_key_entry_c)){
     ^
In file included from /opt/upgw//daemon/nts/nts_lookup.h:19:0,
                 from /opt/upgw//daemon/nes_ring.h:19,
                 from /opt/upgw/daemon/nts/nts_domainame.h:2,
                 from /opt/upgw/daemon/nts/nts_domainame.c:5:
/opt/upgw//libs/libnes_lookup/libnes_lookup.h:69:6: note: expected ‘void **’ but argument is of type ‘struct dns_pkt_key_s **’
 int  nes_lookup_entry_get(nes_lookup_table_t *lookup, const void *key, void **pentry);
      ^

104、/* warning: passing argument 3 of ‘nes_lookup_entry_find’ from incompatible pointer type */
原因:同97。
修改方法:同97。

/opt/upgw/daemon/nts/nts_domainame.c: In function ‘dns_pkt_key_del’:
/opt/upgw/daemon/nts/nts_domainame.c:497:27: warning: unused variable ‘dns_pkt_key_entry’ [-Wunused-variable]
     struct dns_pkt_key_s* dns_pkt_key_entry;
                           ^

105、/* warning: unused variable ‘dns_pkt_key_entry’ */
原因:同2。
修改方法:同2。

/opt/upgw/daemon/nts/nts_domainame.c: In function ‘dns_pkt_key_check’:
/opt/upgw/daemon/nts/nts_domainame.c:511:5: warning: passing argument 3 of ‘nes_lookup_entry_find’ from incompatible pointer type [enabled by default]
     if(NES_SUCCESS == nes_lookup_entry_find(&dns_pkt_key_lookup_table, transaction_id, &dns_pkt_key_entry)){
     ^
In file included from /opt/upgw//daemon/nts/nts_lookup.h:19:0,
                 from /opt/upgw//daemon/nes_ring.h:19,
                 from /opt/upgw/daemon/nts/nts_domainame.h:2,
                 from /opt/upgw/daemon/nts/nts_domainame.c:5:
/opt/upgw//libs/libnes_lookup/libnes_lookup.h:78:6: note: expected ‘void **’ but argument is of type ‘struct dns_pkt_key_s **’
 int  nes_lookup_entry_find(nes_lookup_table_t *lookup, const void *key, void **pentry);
      ^
/opt/upgw/daemon/nts/nts_domainame.c: In function ‘dns_pkt_key_reliability_check’:
/opt/upgw/daemon/nts/nts_domainame.c:529:5: warning: passing argument 3 of ‘nes_lookup_entry_find’ from incompatible pointer type [enabled by default]
     if(NES_SUCCESS == nes_lookup_entry_find(&dns_pkt_key_lookup_table, transaction_id, &dns_pkt_key_entry)){
     ^
In file included from /opt/upgw//daemon/nts/nts_lookup.h:19:0,
                 from /opt/upgw//daemon/nes_ring.h:19,
                 from /opt/upgw/daemon/nts/nts_domainame.h:2,
                 from /opt/upgw/daemon/nts/nts_domainame.c:5:
/opt/upgw//libs/libnes_lookup/libnes_lookup.h:78:6: note: expected ‘void **’ but argument is of type ‘struct dns_pkt_key_s **’
 int  nes_lookup_entry_find(nes_lookup_table_t *lookup, const void *key, void **pentry);
      ^

106、/* warning: passing argument 3 of ‘nes_lookup_entry_find’ from incompatible pointer type */
原因:同97。
修改方法:同97。

/opt/upgw/daemon/nts/nts_domainame.c: At top level:
/opt/upgw/daemon/nts/nts_domainame.c:555:5: warning: no previous prototype for ‘dns_pkt_key_invalid_date_clear’ [-Wmissing-prototypes]
 int dns_pkt_key_invalid_date_clear(void)
     ^

107、/* warning: no previous prototype for ‘dns_pkt_key_invalid_date_clear’ */
原因:同1
修改方法:在相应的.h里面增加声明。

/opt/upgw/daemon/nts/nts_domainame.c: In function ‘dns_pkt_key_invalid_date_clear’:
/opt/upgw/daemon/nts/nts_domainame.c:563:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(i = 0; i <= dns_pkt_key_lookup_table.number_of_entries; i++){
                  ^
/opt/upgw/daemon/nts/nts_domainame.c:564:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if(cnt >= dns_pkt_key_entry_cnt)
                ^

108、/* warning: comparison between signed and unsigned integer expressions */
原因:同16。
修改方法:修改i和cnt的变量类型。

/opt/upgw/daemon/nts/nts_domainame.c: At top level:
/opt/upgw/daemon/nts/nts_domainame.c:630:5: warning: no previous prototype for ‘domainame_parse_etheraddr’ [-Wmissing-prototypes]
 int domainame_parse_etheraddr(const char *buf, void *res, unsigned ressize)
     ^

109、/* warning: no previous prototype for ‘domainame_parse_etheraddr’ */
原因:同1。
修改方法:加static修饰。

/opt/upgw/daemon/nts/nts_domainame.c: In function ‘domainame_parse_etheraddr’:
/opt/upgw/daemon/nts/nts_domainame.c:642:5: warning: implicit declaration of function ‘cmdline_isendoftoken’ [-Wimplicit-function-declaration]
     while (!cmdline_isendoftoken(buf[token_len]))
     ^
/opt/upgw/daemon/nts/nts_domainame.c:642:5: warning: nested extern declaration of ‘cmdline_isendoftoken’ [-Wnested-externs]

110、/* warning: implicit declaration of function ‘cmdline_isendoftoken’ */
/* warning: nested extern declaration of ‘cmdline_isendoftoken’ */
原因:同35
修改方法:同35

/opt/upgw/daemon/nts/nts_domainame.c: At top level:
/opt/upgw/daemon/nts/nts_domainame.c:676:5: warning: no previous prototype for ‘lbp_data_get’ [-Wmissing-prototypes]
 int lbp_data_get(struct dns_lbp_data_s *lbp)
     ^

111、/* warning: no previous prototype for ‘lbp_data_get’ */
原因:同1。
修改方法:在对应的.h中声明。

/opt/upgw/daemon/nts/nts_domainame.c: In function ‘nes_dns_rule_setup’:
/opt/upgw/daemon/nts/nts_domainame.c:717:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for (i=0; i<count; i++) {
                    ^
/opt/upgw/daemon/nts/nts_domainame.c: In function ‘nes_dns_rule_entry_clearall’:
/opt/upgw/daemon/nts/nts_domainame.c:755:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (j = 0; j <= nes_uuid_domainame_lookup_table.number_of_entries; j++) {
                   ^

112、/* warning: comparison between signed and unsigned integer expressions */             原因:同16。
修改方法:修改i和j的变量类型。

/opt/upgw/daemon/nts/nts_domainame.c:764:9: warning: implicit declaration of function ‘rte_free’ [-Wimplicit-function-declaration]
         rte_free(nes_uuid_domainame_lookup_table.entries[j]);
         ^
/opt/upgw/daemon/nts/nts_domainame.c:764:9: warning: nested extern declaration of ‘rte_free’ [-Wnested-externs]

113、/* warning: implicit declaration of function ‘rte_free’ */
/* warning: nested extern declaration of ‘rte_free’ */
原因:同35。
修改方法:同35。

In file included from /opt/upgw/daemon/nts/nts_domainame.c:8:0:
/opt/upgw/daemon/nts/nts_domainame.c: At top level:
/opt/upgw//libs/libnes_redis/libnes_redis.h:12:13: warning: ‘REDIS_HOST’ defined but not used [-Wunused-variable]
 static char REDIS_HOST[50];
             ^
/opt/upgw//libs/libnes_redis/libnes_redis.h:13:17: warning: ‘REDIS_PORT’ defined but not used [-Wunused-variable]
 static uint16_t REDIS_PORT;
                 ^

114、/* warning: ‘REDIS_HOST’ defined but not used */
原因:同91。
修改方法:同91。

/opt/upgw/daemon/nts/nts_domainame.c: In function ‘lbp_data_collect’:
/opt/upgw/daemon/nts/nts_domainame.c:674:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^

115、/* warning: control reaches end of non-void function */
原因:同17。
修改方法:同17。

/opt/upgw/daemon/nts/nts_domainame.c: In function ‘dns_pkt_key_invalid_date_clear’:
/opt/upgw/daemon/nts/nts_domainame.c:564:16: warning: ‘cnt’ is used uninitialized in this function [-Wuninitialized]
         if(cnt >= dns_pkt_key_entry_cnt)
                ^

116、/* warning: ‘cnt’ is used uninitialized in this function */
原因:cnt未初始化,是一个随机值。
修改方法:cnt赋予初值0。

  CC bypass/bpctl.o
  LD nes-daemon
  INSTALL-APP nes-daemon
  INSTALL-MAP nes-daemon.map
== client
  CC nes_cli.o
/opt/upgw/client/nes_cli.c: In function ‘nes_ctrl_route_del_parsed’:
/opt/upgw/client/nes_cli.c:178:5: warning: implicit declaration of function ‘nes_route_remove_by_uuid’ [-Wimplicit-function-declaration]
     if (NES_SUCCESS == nes_route_remove_by_uuid(&remote_NEV, res->route_rule_uuid))
     ^
/opt/upgw/client/nes_cli.c:178:5: warning: nested extern declaration of ‘nes_route_remove_by_uuid’ [-Wnested-externs]
/opt/upgw/client/nes_cli.c: In function ‘nes_ctrl_route_del_mirror_parsed’:
/opt/upgw/client/nes_cli.c:188:5: warning: implicit declaration of function ‘nes_route_remove_mirror_by_uuid’ [-Wimplicit-function-declaration]
     if (NES_SUCCESS == nes_route_remove_mirror_by_uuid(&remote_NEV, res->route_rule_uuid))
     ^
/opt/upgw/client/nes_cli.c:188:5: warning: nested extern declaration of ‘nes_route_remove_mirror_by_uuid’ [-Wnested-externs]

117、/* warning: implicit declaration of function */
/* warning: nested extern declaration of ‘nes_route_remove_by_uuid’ */
原因:同35。
修改方法:同35。

/opt/upgw/client/nes_cli.c: In function ‘nes_ctrl_dns_show_all_parsed’:
/opt/upgw/client/nes_cli.c:241:14: warning: unused variable ‘entry_offset’ [-Wunused-variable]
     uint16_t entry_offset = 0;
              ^
/opt/upgw/client/nes_cli.c:240:14: warning: unused variable ‘entry_cnt’ [-Wunused-variable]
     uint16_t entry_cnt = DOMAIN_NAME_SUPPORT_MAX;
              ^

118、/* warning: unused variable ‘entry_offset’ */
原因:同2。
修改方法:同2。

/opt/upgw/client/nes_cli.c: At top level:
/opt/upgw/client/nes_cli.c:296:5: warning: no previous prototype for ‘nes_ctrl_dns_show_parsed’ [-Wmissing-prototypes]
 int nes_ctrl_dns_show_parsed(void *parsed_result, __attribute__((unused)) struct cmdline *nes_cmdline,
     ^

119、/* warning: no previous prototype for ‘nes_ctrl_dns_show_parsed’ */
原因:同1。
修改方法:加static修饰。

/opt/upgw/client/nes_cli.c: In function ‘nes_ctrl_dns_show_parsed’:
/opt/upgw/client/nes_cli.c:319:9: warning: implicit declaration of function ‘nes_domain_name_show’ [-Wimplicit-function-declaration]
         if (NES_SUCCESS != nes_domain_name_show(&remote_NEV, &domains, &domain_cnt, dns_rule_uuid)) {
         ^
/opt/upgw/client/nes_cli.c:319:9: warning: nested extern declaration of ‘nes_domain_name_show’ [-Wnested-externs]

120、/* warning: implicit declaration of function ‘nes_domain_name_show’ */
/* warning: nested extern declaration of ‘nes_domain_name_show’ */
原因:同35。
修改方法:同35。

/opt/upgw/client/nes_cli.c:321:13: warning: ‘return’ with no value, in function returning non-void [-Wreturn-type]
             return;
             ^

121、/* warning: ‘return’ with no value, in function returning non-void */
原因:函数定义的返回值为int,但却按照void返回。
修改方法:返回对应类型的值。

/opt/upgw/client/nes_cli.c:302:14: warning: unused variable ‘entry_cnt’ [-Wunused-variable]
     uint16_t entry_cnt = DOMAIN_NAME_SUPPORT_MAX;
              ^

122、/* warning: unused variable ‘entry_cnt’ */
原因:同2。
修改方法:同2。

/opt/upgw/client/nes_cli.c: In function ‘nes_ctrl_bypass’:
/opt/upgw/client/nes_cli.c:413:5: warning: implicit declaration of function ‘nes_bypass_client’ [-Wimplicit-function-declaration]
     if (NES_SUCCESS != nes_bypass_client(&remote_NEV, res->bypass_data_string))
     ^
/opt/upgw/client/nes_cli.c:413:5: warning: nested extern declaration of ‘nes_bypass_client’ [-Wnested-externs]
/opt/upgw/client/nes_cli.c: In function ‘nes_set_loglevel’:
/opt/upgw/client/nes_cli.c:447:5: warning: implicit declaration of function ‘nes_loglevel_set_client’ [-Wimplicit-function-declaration]
     if (NES_SUCCESS != nes_loglevel_set_client(&remote_NEV, res->loglevel))
     ^
/opt/upgw/client/nes_cli.c:447:5: warning: nested extern declaration of ‘nes_loglevel_set_client’ [-Wnested-externs]

123、/* implicit declaration of function ‘nes_bypass_client’ */
/* warning: nested extern declaration of ‘nes_bypass_client’ */
原因:同35。
修改方法:同35。

/opt/upgw/client/nes_cli.c: At top level:
/opt/upgw/client/nes_cli.c:544:5: warning: initialization from incompatible pointer type [enabled by default]
     .f = nes_ctrl_dns_show_parsed,
     ^
/opt/upgw/client/nes_cli.c:544:5: warning: (near initialization for ‘cmd_ctrl_domain_name_show.f’) [enabled by default]

124、/* warning: initialization from incompatible pointer type */
原因:注册的函数(f)与实际实现函数(nes_ctrl_dns_show_parsed)的返回值不同。
修改方法:修改nes_ctrl_dns_show_parsed函数的返回值为void。

/opt/upgw/client/nes_cli.c: In function ‘nes_ctrl_route_show_parsed’:
/opt/upgw/client/nes_cli.c:607:5: warning: passing argument 2 of ‘memset’ makes integer from pointer without a cast [enabled by default]
     memset(lookup_str, "\0", NES_MAX_LOOKUP_ENTRY_LEN + 1);
     ^
In file included from /usr/include/features.h:375:0,
                 from /usr/include/stdint.h:25,
                 from /usr/lib/gcc/x86_64-redhat-linux/4.8.5/include/stdint.h:9,
                 from /opt/upgw/client/nes_cli.c:11:
/usr/include/bits/string3.h:76:1: note: expected ‘int’ but argument is of type ‘const char *’
 __NTH (memset (void *__dest, int __ch, size_t __len))
 ^

125、/* warning: passing argument 2 of ‘memset’ makes integer from pointer without a cast */
原因:memset传递的第二个参数是字符串。
修改方法:改为0或者字符。

/opt/upgw/client/nes_cli.c:612:5: warning: implicit declaration of function ‘nes_route_show_by_uuid’ [-Wimplicit-function-declaration]
     if (NES_SUCCESS == nes_route_show_by_uuid(&remote_NEV, res->route_rule_uuid,
     ^
/opt/upgw/client/nes_cli.c:612:5: warning: nested extern declaration of ‘nes_route_show_by_uuid’ [-Wnested-externs]

126、/* warning: implicit declaration of function ‘nes_route_show_by_uuid’ */
/* warning: nested extern declaration of ‘nes_route_show_by_uuid’ */
原因:同35。
修改方法:同35。

  CC nes_client.o
  CC nes_cmdline_parse_string.o
  LD nes_client
  INSTALL-APP nes_client
  INSTALL-MAP nes_client.map

共性问题总结

以上是所有的告警,一些问题总是在不断重复,下面是摘出的重复问题,编号与上面的对应。

1、/* warning: no previous prototype for ‘nes_bypass_client’ */
原因:该函数未声明。
修改方法:如果告警函数只在文件内部使用,在函数前面添加static即可消除告警;如果告警函数在其它文件被调用,则需在对应的.h文件中声明。此处因为其它文件有调用,所以选择第二种方式。

70、/* ‘nes_dev_kni_alloc’ declared ‘static’ but never defined [-Wunused-function] */
/* warning: ‘REDIS_HOST’ defined but not used [-Wunused-variable] */
原因:static修饰的函数和变量已经在.c文件中定义,不需要在.h声明,若没有static修饰,可以在.h声明,变量必须要用extern修饰。
修改方法:将这几处删除。

编程建议:对于需要其它文件使用的函数,应在头文件里面声明,其它文件引用这个头文件后方可使用;只需要在本文件中使用的函数,需要加static修饰;static修饰过的表示只在本文件使用,不能再进行声明。

2、/* warning: unused variable ‘ret’ */
原因:变量未被使用。
修改方法:删除该变量。

89、/* warning: ‘REDIS_HOST’ defined but not used */
原因:变量定义后未被使用。
修改方法:删除此变量。

编程建议:函数中不要出现无用变量。

14、/* warning: function declaration isn’t a prototype */
/* warning: old-style function definition */
原因:函数未声明;函数没有参数。
修改方法:加static修饰;没有参数需加void。

59、/* warning: unused parameter ‘ingress_ring’ */
原因:函数中定义的入参没有使用到。
修改方法:为了保证注册函数的一致性,这里不能删除入参,所以增加了对ingress_ring的判断代码:
if (NULL == ingress_ring) {
    return ret;
}

编程建议:定义的函数若无参数,则需要加void关键字;若有参数则不要出现无用的参数。

4、/* warning: assignment from incompatible pointer type */
原因:参数类型不匹配,需要的类型是struct rte_cfgfile *,而传入的nes_routefile类型是struct rte_routefile *。
修改方法:struct rte_routefile和struct rte_cfgfile中定义的变量一致,将nes_routefile改为struct rte_cfgfile *类型。

15、/* warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘long long int’ */
原因:变量类型与打印形式不匹配。
修改方法:打印方法变为%lld。

16、/* warning: comparison between signed and unsigned integer expressions */
原因:有符号和无符号之间的比较,防止一个负的符号型数据转化为无符号型时,会产生一个不是我们想要的很大的数据。
修改方法:将i改为无符号类型。

32、/* warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 5 has type ‘uint64_t’ */
原因:变量类型与打印形式不匹配,uint64_t在32位系统中表示为long long int,在64位系统中表示long int。
修改方法:为了同时支持32位和64位操作系统,使用%"PRIu64"打印。

62、/* warning: passing argument 1 of ‘nes_uuid_lookup_entry_add’ from incompatible pointer type */
原因:传参类型不正确。
修改方法:传入参数时强转为为const char *类型。

72、/* warning: assignment discards ‘const’ qualifier from pointer target type */
原因:赋值时两端类型不一致。
修改方法:定义bypass_parameter_list时加上const。

95、/* warning: passing argument 3 of ‘nes_lookup_entry_find’ from incompatible pointer type */
原因:定义参数和传入参数类型不一致。
修改方法:传参时强转为void ** 。

编程建议:赋值、打印和传参时,要使类型一致,若无法一致的,需要做强制类型转换,但是不建议有符号数转为无符号数,const类型转为非const类型,其它类型做强制转换时,也要看清数据范围是否满足。

13、/* warning: return discards ‘const’ qualifier from pointer target type */
原因:函数实际的返回值与定义函数的返回值不一致。
修改方法:函数定义的返回值类型也加const修饰。

17、/* warning: control reaches end of non-void function */
原因:函数末尾没有给出返回值。
解决方法:在末尾添加return返回相应的结果。

39、/* warning: return makes pointer from integer without a cast */
原因:函数定义的返回值和实际返回值不是一个类型。
修改方法:返回值和定义的类型改为一致,变为int。

119、/* warning: ‘return’ with no value, in function returning non-void */
原因:函数定义的返回值为int,但却按照void返回。
修改方法:返回对应类型的值。

编程建议:每个函数在程序结束部分都要有return标识,且需要返回与定义类型一致的返回值。

33、/* warning: missing braces around initializer */
/* warning: (near initialization for ‘tuples[0]’) */
原因:初始化不合理。
修改方法:使用memset函数将结构体数组置0。

60、/* warning: ‘inner_ipv4_hdr’ may be used uninitialized in this function */
原因:inner_ipv4_hdr指针未初始化。
修改方法:inner_ipv4_hdr赋予初值NULL。

114、/* warning: ‘cnt’ is used uninitialized in this function */
原因:cnt未初始化,是一个随机值。
修改方法:cnt赋予初值0。

123、/* warning: passing argument 2 of ‘memset’ makes integer from pointer without a cast */
原因:memset传递的第二个参数是字符串。
修改方法:改为0或者字符。

编程建议:变量在定义的同时最好能够进行初始化,使用memset初始化变量时要注意两点,一是该函数为逐字节初始化,当初始化为非0值时,非字符型变量不能用此函数初始化,二是初始化的长度要与变量长度一致。

11、/* ignoring return value of ‘fgets’, declared with attribute warn_unused_result */
原因:未对返回值处理。
修改方法:添加对返回值的判断:if (fgets(entry, 320, route_file) != NULL) {},如果无异常再进行后续的操作。

编程建议:对于一些编译器建议判断返回值的函数,最好去判断下,防止操作指针异常,造成程序挂死。

35、/* warning: implicit declaration of function ‘domainname_check’ */
/* warning: nested extern declaration of ‘domainname_check’ */
原因:该函数未被声明就拿来使用。
修改方法:该函数在对应头文件中声明,若声明过引用头文件。

编程建议:要使用其它文件定义的函数,此函数应是在其头文件中声明过的,使用时要引用其头文件。

100、/* warning: statement with no effect */
原因:赋值号输错。
修改方法:改为*cnt = entry_cnt。

编程建议:赋值符和相等运算符要区分。

122、/* warning: initialization from incompatible pointer type */
原因:注册的函数(f)与实际实现函数(nes_ctrl_dns_show_parsed)的返回值不同。
修改方法:修改nes_ctrl_dns_show_parsed函数的返回值为void。

编程建议:事先注册的函数和具体实现的函数,在参数和返回值上要完全一致。