Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/3710/?format=api
https://patches.dpdk.org/api/patches/3710/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/patch/20150225142851.55406347@miho/", "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": "<20150225142851.55406347@miho>", "list_archive_url": "https://inbox.dpdk.org/dev/20150225142851.55406347@miho", "date": "2015-02-25T13:28:51", "name": "[dpdk-dev] headers: typeof -> __typeof__ to unbreak C++11 code", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "d348b5f9699e5c64a929d0667c11163a0f0dd703", "submitter": { "id": 180, "url": "https://patches.dpdk.org/api/people/180/?format=api", "name": "Simon Kagstrom", "email": "simon.kagstrom@netinsight.net" }, "delegate": null, "mbox": "https://patches.dpdk.org/project/dpdk/patch/20150225142851.55406347@miho/mbox/", "series": [], "comments": "https://patches.dpdk.org/api/patches/3710/comments/", "check": "pending", "checks": "https://patches.dpdk.org/api/patches/3710/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 5C25C9A94;\n\tWed, 25 Feb 2015 14:29:00 +0100 (CET)", "from ernst.netinsight.se (ernst.netinsight.se [194.16.221.21])\n\tby dpdk.org (Postfix) with SMTP id 209849A94\n\tfor <dev@dpdk.org>; Wed, 25 Feb 2015 14:28:58 +0100 (CET)", "from miho (unverified [10.100.1.152]) by ernst.netinsight.se\n\t(EMWAC SMTPRS 0.83) with SMTP id <B0029135642@ernst.netinsight.se>;\n\tWed, 25 Feb 2015 14:28:51 +0100" ], "Date": "Wed, 25 Feb 2015 14:28:51 +0100", "From": "Simon Kagstrom <simon.kagstrom@netinsight.net>", "To": "dev@dpdk.org", "Message-ID": "<20150225142851.55406347@miho>", "X-Mailer": "Claws Mail 3.9.3 (GTK+ 2.24.23; x86_64-pc-linux-gnu)", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=US-ASCII", "Content-Transfer-Encoding": "7bit", "Subject": "[dpdk-dev] [PATCH] headers: typeof -> __typeof__ to unbreak C++11\n\tcode", "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 compiling C++11-code or above (--std=c++11), the build fails with\nlots of\n\n rte_eth_ctrl.h:517:3: note: in expansion of macro RTE_ALIGN\n (RTE_ALIGN(RTE_ETH_FLOW_MAX, UINT32_BIT)/UINT32_BIT)\n ^\n\nWhen reading the GCC info pages, I get the feeling that __typeof__ is\na better choice, and that indeed works when including the headers in\nC++ files (--std=c++11).\n\nThere are some typeof()s left in C files, the patch only touches the\npublic API.\n\nSigned-off-by: Simon Kagstrom <simon.kagstrom@netinsight.net>\n---\n lib/librte_acl/acl_vect.h | 8 ++++----\n lib/librte_eal/common/include/rte_common.h | 17 +++++++++--------\n lib/librte_eal/common/include/rte_pci.h | 2 +-\n 3 files changed, 14 insertions(+), 13 deletions(-)", "diff": "diff --git a/lib/librte_acl/acl_vect.h b/lib/librte_acl/acl_vect.h\nindex 6cc1999..de47071 100644\n--- a/lib/librte_acl/acl_vect.h\n+++ b/lib/librte_acl/acl_vect.h\n@@ -52,8 +52,8 @@ extern \"C\" {\n * hi - contains high 32 bits of given N transitions.\n */\n #define\tACL_TR_HILO(P, TC, tr0, tr1, lo, hi) do { \\\n-\tlo = (typeof(lo))_##P##_shuffle_ps((TC)(tr0), (TC)(tr1), 0x88); \\\n-\thi = (typeof(hi))_##P##_shuffle_ps((TC)(tr0), (TC)(tr1), 0xdd); \\\n+\tlo = (__typeof__(lo))_##P##_shuffle_ps((TC)(tr0), (TC)(tr1), 0x88); \\\n+\thi = (__typeof__(hi))_##P##_shuffle_ps((TC)(tr0), (TC)(tr1), 0xdd); \\\n } while (0)\n \n \n@@ -74,8 +74,8 @@ extern \"C\" {\n \taddr, index_mask, next_input, shuffle_input,\t\t\\\n \tones_16, range_base, tr_lo, tr_hi) do {\t\\\n \t\t\t\t\t\t\t\t\\\n-\ttypeof(addr) in, node_type, r, t;\t\t\t\\\n-\ttypeof(addr) dfa_msk, dfa_ofs, quad_ofs;\t\t\\\n+\t__typeof__(addr) in, node_type, r, t;\t\t\t\\\n+\t__typeof__(addr) dfa_msk, dfa_ofs, quad_ofs;\t\t\\\n \t\t\t\t\t\t\t\t\\\n \tt = _##P##_xor_si##S(index_mask, index_mask);\t\t\\\n \tin = _##P##_shuffle_epi8(next_input, shuffle_input);\t\\\ndiff --git a/lib/librte_eal/common/include/rte_common.h b/lib/librte_eal/common/include/rte_common.h\nindex 8ac940c..40c2603 100644\n--- a/lib/librte_eal/common/include/rte_common.h\n+++ b/lib/librte_eal/common/include/rte_common.h\n@@ -43,6 +43,7 @@\n \n #ifdef __cplusplus\n extern \"C\" {\n+\n #endif\n \n #include <stdint.h>\n@@ -112,7 +113,7 @@ rte_align_floor_int(uintptr_t ptr, uintptr_t align)\n * must be a power-of-two value.\n */\n #define RTE_PTR_ALIGN_FLOOR(ptr, align) \\\n-\t(typeof(ptr))rte_align_floor_int((uintptr_t)ptr, align)\n+\t(__typeof__(ptr))rte_align_floor_int((uintptr_t)ptr, align)\n \n /**\n * Macro to align a value to a given power-of-two. The resultant value\n@@ -121,7 +122,7 @@ rte_align_floor_int(uintptr_t ptr, uintptr_t align)\n * power-of-two value.\n */\n #define RTE_ALIGN_FLOOR(val, align) \\\n-\t(typeof(val))((val) & (~((typeof(val))((align) - 1))))\n+\t(__typeof__(val))((val) & (~((__typeof__(val))((align) - 1))))\n \n /**\n * Macro to align a pointer to a given power-of-two. The resultant\n@@ -130,7 +131,7 @@ rte_align_floor_int(uintptr_t ptr, uintptr_t align)\n * must be a power-of-two value.\n */\n #define RTE_PTR_ALIGN_CEIL(ptr, align) \\\n-\tRTE_PTR_ALIGN_FLOOR((typeof(ptr))RTE_PTR_ADD(ptr, (align) - 1), align)\n+\tRTE_PTR_ALIGN_FLOOR((__typeof__(ptr))RTE_PTR_ADD(ptr, (align) - 1), align)\n \n /**\n * Macro to align a value to a given power-of-two. The resultant value\n@@ -139,7 +140,7 @@ rte_align_floor_int(uintptr_t ptr, uintptr_t align)\n * value.\n */\n #define RTE_ALIGN_CEIL(val, align) \\\n-\tRTE_ALIGN_FLOOR(((val) + ((typeof(val)) (align) - 1)), align)\n+\tRTE_ALIGN_FLOOR(((val) + ((__typeof__(val)) (align) - 1)), align)\n \n /**\n * Macro to align a pointer to a given power-of-two. The resultant\n@@ -257,8 +258,8 @@ rte_align64pow2(uint64_t v)\n * Macro to return the minimum of two numbers\n */\n #define RTE_MIN(a, b) ({ \\\n-\t\ttypeof (a) _a = (a); \\\n-\t\ttypeof (b) _b = (b); \\\n+\t\t__typeof__ (a) _a = (a); \\\n+\t\t__typeof__ (b) _b = (b); \\\n \t\t_a < _b ? _a : _b; \\\n \t})\n \n@@ -266,8 +267,8 @@ rte_align64pow2(uint64_t v)\n * Macro to return the maximum of two numbers\n */\n #define RTE_MAX(a, b) ({ \\\n-\t\ttypeof (a) _a = (a); \\\n-\t\ttypeof (b) _b = (b); \\\n+\t\t__typeof__ (a) _a = (a); \\\n+\t\t__typeof__ (b) _b = (b); \\\n \t\t_a > _b ? _a : _b; \\\n \t})\n \ndiff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h\nindex 3df07e8..bc065d4 100644\n--- a/lib/librte_eal/common/include/rte_pci.h\n+++ b/lib/librte_eal/common/include/rte_pci.h\n@@ -212,7 +212,7 @@ do { \\\n \tval = strtoul((in), &end, 16); \\\n \tif (errno != 0 || end[0] != (dlm) || val > (lim)) \\\n \t\treturn (-EINVAL); \\\n-\t(fd) = (typeof (fd))val; \\\n+\t(fd) = (__typeof__ (fd))val; \\\n \t(in) = end + 1; \\\n } while(0)\n \n", "prefixes": [ "dpdk-dev" ] }{ "id": 3710, "url": "