Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/14638/?format=api
https://patches.dpdk.org/api/patches/14638/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/patch/1467905790-10597-8-git-send-email-thomas.monjalon@6wind.com/", "project": { "id": 1, "url": "https://patches.dpdk.org/api/projects/1/?format=api", "name": "DPDK", "link_name": "dpdk", "list_id": "dev.dpdk.org", "list_email": "dev@dpdk.org", "web_url": "http://core.dpdk.org", "scm_url": "git://dpdk.org/dpdk", "webscm_url": "http://git.dpdk.org/dpdk", "list_archive_url": "https://inbox.dpdk.org/dev", "list_archive_url_format": "https://inbox.dpdk.org/dev/{}", "commit_url_format": "" }, "msgid": "<1467905790-10597-8-git-send-email-thomas.monjalon@6wind.com>", "list_archive_url": "https://inbox.dpdk.org/dev/1467905790-10597-8-git-send-email-thomas.monjalon@6wind.com", "date": "2016-07-07T15:36:26", "name": "[dpdk-dev,07/11] pmdinfogen: fix build warnings", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "76593aa7da3ec6b6200e9de8e8dc648001044137", "submitter": { "id": 1, "url": "https://patches.dpdk.org/api/people/1/?format=api", "name": "Thomas Monjalon", "email": "thomas.monjalon@6wind.com" }, "delegate": null, "mbox": "https://patches.dpdk.org/project/dpdk/patch/1467905790-10597-8-git-send-email-thomas.monjalon@6wind.com/mbox/", "series": [], "comments": "https://patches.dpdk.org/api/patches/14638/comments/", "check": "pending", "checks": "https://patches.dpdk.org/api/patches/14638/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<dev-bounces@dpdk.org>", "X-Original-To": "patchwork@dpdk.org", "Delivered-To": "patchwork@dpdk.org", "Received": [ "from [92.243.14.124] (localhost [IPv6:::1])\n\tby dpdk.org (Postfix) with ESMTP id CFA6F5398;\n\tThu, 7 Jul 2016 17:36:43 +0200 (CEST)", "from mail-wm0-f53.google.com (mail-wm0-f53.google.com\n\t[74.125.82.53]) by dpdk.org (Postfix) with ESMTP id 579B74B79\n\tfor <dev@dpdk.org>; Thu, 7 Jul 2016 17:36:41 +0200 (CEST)", "by mail-wm0-f53.google.com with SMTP id n127so21203887wme.1\n\tfor <dev@dpdk.org>; Thu, 07 Jul 2016 08:36:41 -0700 (PDT)", "from XPS13.localdomain (184.203.134.77.rev.sfr.net.\n\t[77.134.203.184]) by smtp.gmail.com with ESMTPSA id\n\tp126sm559331wmp.13.2016.07.07.08.36.40\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128);\n\tThu, 07 Jul 2016 08:36:40 -0700 (PDT)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=6wind-com.20150623.gappssmtp.com; s=20150623;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=rMRTL+XrRME+7VGRSxGwonKvfYmkLktM8G11UXehMY8=;\n\tb=PThCIBrRsahq+KhWKu2xRLrBBWBBQCyTx9W1y5aljEwcu+V3Sz0+8rnvyRSTn81dcm\n\t+kMDRlLVPkqhrEKPK+/lo2h9qYAR/vpTslCcxkA5E7Xhr+92Fwc/B48oIEMBCJJLtVW+\n\tjiNbqHkc4ejcC2fLhFn/eovDnOZefcy2nnVZF6mVQKlOPUHl7lnu+0N2inElJDHWraxC\n\tsfk5cEn8x0YvOLREuaD1oukOIRZ0DFonWgg0tHqNS/Z3t0laLBRIEt3yyWy383504ftd\n\t0hYUcbLMZPmeMXdTNf318NeBag0OXFuh0eHPe2WPbZ80ETQr1btu+6rRHkaY/ZjKAZqQ\n\tYf/Q==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20130820;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=rMRTL+XrRME+7VGRSxGwonKvfYmkLktM8G11UXehMY8=;\n\tb=m1pk2VC0kqG8fDdsMgROYAA+7Vu2OCSnXnexIhDl94EQom0YI5L/AEKXjcm46wIlZI\n\tEBqZURI6cZFJkbLw+J2wMouY5f0qX0I0vhryfg59g/2vhkRENs879i90a0P/1BzxndjJ\n\tugFZfw48ojW06B4y15+pIZxajPmy6oWSL+kn8BeTxnfFnNRU5kZDdwn67Sg+KFqSkVpa\n\tKr5pdbcF0MA31Lc9AfZ2JmDKsyml9NHhC5k3b/L5tQAbJfeRYtIOmZQGuSHTLRocW1nQ\n\t875nIY9KdfR2d51JfvY+vTcf1I4R6NaFRpbxlrg02w4xX/50/edIUqpJuU/m00bVo2mY\n\tXrTw==", "X-Gm-Message-State": "ALyK8tKfHT4c4Ff+y8GEhQageGCMJSJxvwnUgzGzfTM8caBgu4W+/R5obtMdIUncYrgqeJyc", "X-Received": "by 10.28.214.73 with SMTP id n70mr3424253wmg.13.1467905801099;\n\tThu, 07 Jul 2016 08:36:41 -0700 (PDT)", "From": "Thomas Monjalon <thomas.monjalon@6wind.com>", "To": "Neil Horman <nhorman@tuxdriver.com>", "Cc": "dev@dpdk.org", "Date": "Thu, 7 Jul 2016 17:36:26 +0200", "Message-Id": "<1467905790-10597-8-git-send-email-thomas.monjalon@6wind.com>", "X-Mailer": "git-send-email 2.7.0", "In-Reply-To": "<1467905790-10597-1-git-send-email-thomas.monjalon@6wind.com>", "References": "<1467905790-10597-1-git-send-email-thomas.monjalon@6wind.com>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=UTF-8", "Content-Transfer-Encoding": "8bit", "Subject": "[dpdk-dev] [PATCH 07/11] pmdinfogen: fix build warnings", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.15", "Precedence": "list", "List-Id": "patches and discussions about DPDK <dev.dpdk.org>", "List-Unsubscribe": "<http://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>", "List-Archive": "<http://dpdk.org/ml/archives/dev/>", "List-Post": "<mailto:dev@dpdk.org>", "List-Help": "<mailto:dev-request@dpdk.org?subject=help>", "List-Subscribe": "<http://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "When compiled with a standard clang, pmdinfogen can raise a warning:\n buildtools/pmdinfogen/pmdinfogen.c:365:1: warning:\n control reaches end of non-void function\n\nActually there can be more warnings with stricter compilers.\nIn order to catch them early and fix most of them, the DPDK standard flags\nWERROR_FLAGS are used.\n\nThe warnings fixed are:\n no previous prototype for ...\n no return statement in function returning non-void\n variable ‘secstrings’ set but not used\n ‘sec_name’ defined but not used\n ‘get_symbol_index’ defined but not used\n pointer of type ‘void *’ used in arithmetic\n\nFixes: 98b0fdb0ffc6 (\"pmdinfogen: add buildtools and pmdinfogen utility\")\n\nSigned-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>\n---\n buildtools/pmdinfogen/Makefile | 4 +--\n buildtools/pmdinfogen/pmdinfogen.c | 58 ++++++++++++--------------------------\n 2 files changed, 20 insertions(+), 42 deletions(-)", "diff": "diff --git a/buildtools/pmdinfogen/Makefile b/buildtools/pmdinfogen/Makefile\nindex 125901b..3885d3b 100644\n--- a/buildtools/pmdinfogen/Makefile\n+++ b/buildtools/pmdinfogen/Makefile\n@@ -41,9 +41,9 @@ HOSTAPP = pmdinfogen\n #\n SRCS-y += pmdinfogen.c\n \n-HOST_EXTRA_CFLAGS += -g -I${RTE_OUTPUT}/include\n+HOST_CFLAGS += $(WERROR_FLAGS) -g\n+HOST_CFLAGS += -I$(RTE_OUTPUT)/include\n \n DEPDIRS-y += lib/librte_eal\n \n include $(RTE_SDK)/mk/rte.hostapp.mk\n-\ndiff --git a/buildtools/pmdinfogen/pmdinfogen.c b/buildtools/pmdinfogen/pmdinfogen.c\nindex 0947dc6..beb06f1 100644\n--- a/buildtools/pmdinfogen/pmdinfogen.c\n+++ b/buildtools/pmdinfogen/pmdinfogen.c\n@@ -15,6 +15,7 @@\n #include <limits.h>\n #include <stdbool.h>\n #include <errno.h>\n+#include <rte_common.h>\n #include \"pmdinfogen.h\"\n \n #ifdef RTE_ARCH_64\n@@ -32,7 +33,7 @@ static const char *sym_name(struct elf_info *elf, Elf_Sym *sym)\n \t\treturn \"(unknown)\";\n }\n \n-void *grab_file(const char *filename, unsigned long *size)\n+static void *grab_file(const char *filename, unsigned long *size)\n {\n \tstruct stat st;\n \tvoid *map = MAP_FAILED;\n@@ -59,7 +60,7 @@ failed:\n * spaces in the beginning of the line is trimmed away.\n * Return a pointer to a static buffer.\n **/\n-void release_file(void *file, unsigned long size)\n+static void release_file(void *file, unsigned long size)\n {\n \tmunmap(file, size);\n }\n@@ -67,9 +68,8 @@ void release_file(void *file, unsigned long size)\n \n static void *get_sym_value(struct elf_info *info, const Elf_Sym *sym)\n {\n-\tvoid *ptr = (void *)info->hdr + info->sechdrs[sym->st_shndx].sh_offset;\n-\n-\treturn (void *)(ptr + sym->st_value);\n+\treturn RTE_PTR_ADD(info->hdr,\n+\t\tinfo->sechdrs[sym->st_shndx].sh_offset + sym->st_value);\n }\n \n static Elf_Sym *find_sym_in_symtab(struct elf_info *info,\n@@ -95,7 +95,6 @@ static int parse_elf(struct elf_info *info, const char *filename)\n \tElf_Ehdr *hdr;\n \tElf_Shdr *sechdrs;\n \tElf_Sym *sym;\n-\tconst char *secstrings;\n \tint endian;\n \tunsigned int symtab_idx = ~0U, symtab_shndx_idx = ~0U;\n \n@@ -140,7 +139,7 @@ static int parse_elf(struct elf_info *info, const char *filename)\n \thdr->e_shnum = TO_NATIVE(endian, 16, hdr->e_shnum);\n \thdr->e_shstrndx = TO_NATIVE(endian, 16, hdr->e_shstrndx);\n \n-\tsechdrs = (void *)hdr + hdr->e_shoff;\n+\tsechdrs = RTE_PTR_ADD(hdr, hdr->e_shoff);\n \tinfo->sechdrs = sechdrs;\n \n \t/* Check if file offset is correct */\n@@ -191,7 +190,6 @@ static int parse_elf(struct elf_info *info, const char *filename)\n \t\t\tTO_NATIVE(endian, ADDR_SIZE, sechdrs[i].sh_entsize);\n \t}\n \t/* Find symbol table. */\n-\tsecstrings = (void *)hdr + sechdrs[info->secindex_strings].sh_offset;\n \tfor (i = 1; i < info->num_sections; i++) {\n \t\tint nobits = sechdrs[i].sh_type == SHT_NOBITS;\n \n@@ -206,22 +204,22 @@ static int parse_elf(struct elf_info *info, const char *filename)\n \t\tif (sechdrs[i].sh_type == SHT_SYMTAB) {\n \t\t\tunsigned int sh_link_idx;\n \t\t\tsymtab_idx = i;\n-\t\t\tinfo->symtab_start = (void *)hdr +\n-\t\t\t sechdrs[i].sh_offset;\n-\t\t\tinfo->symtab_stop = (void *)hdr +\n-\t\t\t sechdrs[i].sh_offset + sechdrs[i].sh_size;\n+\t\t\tinfo->symtab_start = RTE_PTR_ADD(hdr,\n+\t\t\t\tsechdrs[i].sh_offset);\n+\t\t\tinfo->symtab_stop = RTE_PTR_ADD(hdr,\n+\t\t\t\tsechdrs[i].sh_offset + sechdrs[i].sh_size);\n \t\t\tsh_link_idx = sechdrs[i].sh_link;\n-\t\t\tinfo->strtab = (void *)hdr +\n-\t\t\t sechdrs[sh_link_idx].sh_offset;\n+\t\t\tinfo->strtab = RTE_PTR_ADD(hdr,\n+\t\t\t\tsechdrs[sh_link_idx].sh_offset);\n \t\t}\n \n \t\t/* 32bit section no. table? (\"more than 64k sections\") */\n \t\tif (sechdrs[i].sh_type == SHT_SYMTAB_SHNDX) {\n \t\t\tsymtab_shndx_idx = i;\n-\t\t\tinfo->symtab_shndx_start = (void *)hdr +\n-\t\t\t sechdrs[i].sh_offset;\n-\t\t\tinfo->symtab_shndx_stop = (void *)hdr +\n-\t\t\t sechdrs[i].sh_offset + sechdrs[i].sh_size;\n+\t\t\tinfo->symtab_shndx_start = RTE_PTR_ADD(hdr,\n+\t\t\t\tsechdrs[i].sh_offset);\n+\t\t\tinfo->symtab_shndx_stop = RTE_PTR_ADD(hdr,\n+\t\t\t\tsechdrs[i].sh_offset + sechdrs[i].sh_size);\n \t\t}\n \t}\n \tif (!info->symtab_start)\n@@ -262,28 +260,6 @@ static void parse_elf_finish(struct elf_info *info)\n \t}\n }\n \n-static const char *sec_name(struct elf_info *elf, int secindex)\n-{\n-\tElf_Shdr *sechdrs = elf->sechdrs;\n-\treturn (void *)elf->hdr +\n-\t\telf->sechdrs[elf->secindex_strings].sh_offset +\n-\t\tsechdrs[secindex].sh_name;\n-}\n-\n-static int get_symbol_index(struct elf_info *info, Elf_Sym *sym)\n-{\n-\tconst char *name = sym_name(info, sym);\n-\tconst char *idx;\n-\n-\tidx = name;\n-\twhile (idx) {\n-\t\tif (isdigit(*idx))\n-\t\t\treturn atoi(idx);\n-\t\tidx++;\n-\t}\n-\treturn -1;\n-}\n-\n struct opt_tag {\n \tconst char *suffix;\n \tconst char *json_id;\n@@ -362,6 +338,8 @@ static int locate_pmd_entries(struct elf_info *info)\n \t\t\t}\n \t\t}\n \t} while (last);\n+\n+\treturn 0;\n }\n \n static void output_pmd_info_string(struct elf_info *info, char *outfile)\n", "prefixes": [ "dpdk-dev", "07/11" ] }{ "id": 14638, "url": "