Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.2/patches/833125/?format=api
{ "id": 833125, "url": "http://patchwork.ozlabs.org/api/1.2/patches/833125/?format=api", "web_url": "http://patchwork.ozlabs.org/project/openvswitch/patch/1509572427-19204-1-git-send-email-yihung.wei@gmail.com/", "project": { "id": 47, "url": "http://patchwork.ozlabs.org/api/1.2/projects/47/?format=api", "name": "Open vSwitch", "link_name": "openvswitch", "list_id": "ovs-dev.openvswitch.org", "list_email": "ovs-dev@openvswitch.org", "web_url": "http://openvswitch.org/", "scm_url": "git@github.com:openvswitch/ovs.git", "webscm_url": "https://github.com/openvswitch/ovs", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<1509572427-19204-1-git-send-email-yihung.wei@gmail.com>", "list_archive_url": null, "date": "2017-11-01T21:40:27", "name": "[ovs-dev] packets: Fix C++ compilation issues when include packets.h", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "a0d381fb977364025986197ec33df73f201e085a", "submitter": { "id": 70435, "url": "http://patchwork.ozlabs.org/api/1.2/people/70435/?format=api", "name": "Yi-Hung Wei", "email": "yihung.wei@gmail.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/openvswitch/patch/1509572427-19204-1-git-send-email-yihung.wei@gmail.com/mbox/", "series": [ { "id": 11402, "url": "http://patchwork.ozlabs.org/api/1.2/series/11402/?format=api", "web_url": "http://patchwork.ozlabs.org/project/openvswitch/list/?series=11402", "date": "2017-11-01T21:40:27", "name": "[ovs-dev] packets: Fix C++ compilation issues when include packets.h", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/11402/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/833125/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/833125/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<ovs-dev-bounces@openvswitch.org>", "X-Original-To": [ "incoming@patchwork.ozlabs.org", "dev@openvswitch.org" ], "Delivered-To": [ "patchwork-incoming@bilbo.ozlabs.org", "ovs-dev@mail.linuxfoundation.org" ], "Authentication-Results": [ "ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=openvswitch.org\n\t(client-ip=140.211.169.12; helo=mail.linuxfoundation.org;\n\tenvelope-from=ovs-dev-bounces@openvswitch.org;\n\treceiver=<UNKNOWN>)", "ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"GBD+OSHL\"; dkim-atps=neutral" ], "Received": [ "from mail.linuxfoundation.org (mail.linuxfoundation.org\n\t[140.211.169.12])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3yS1rL1KNCz9sRW\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 2 Nov 2017 08:41:38 +1100 (AEDT)", "from mail.linux-foundation.org (localhost [127.0.0.1])\n\tby mail.linuxfoundation.org (Postfix) with ESMTP id 08B96D37;\n\tWed, 1 Nov 2017 21:41:35 +0000 (UTC)", "from smtp1.linuxfoundation.org (smtp1.linux-foundation.org\n\t[172.17.192.35])\n\tby mail.linuxfoundation.org (Postfix) with ESMTPS id EC66DCF5\n\tfor <dev@openvswitch.org>; Wed, 1 Nov 2017 21:41:33 +0000 (UTC)", "from mail-pg0-f65.google.com (mail-pg0-f65.google.com\n\t[74.125.83.65])\n\tby smtp1.linuxfoundation.org (Postfix) with ESMTPS id 6EB0F1AD\n\tfor <dev@openvswitch.org>; Wed, 1 Nov 2017 21:41:33 +0000 (UTC)", "by mail-pg0-f65.google.com with SMTP id 15so3191786pgc.12\n\tfor <dev@openvswitch.org>; Wed, 01 Nov 2017 14:41:33 -0700 (PDT)", "from vm-01.eng.vmware.com ([208.91.1.34])\n\tby smtp.gmail.com with ESMTPSA id\n\th186sm2498629pfe.66.2017.11.01.14.41.32\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128);\n\tWed, 01 Nov 2017 14:41:32 -0700 (PDT)" ], "X-Greylist": "whitelisted by SQLgrey-1.7.6", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=from:to:cc:subject:date:message-id;\n\tbh=0/qJRDMK9mltokw50pejplZpiLXN+pusGfrwz+sSuUk=;\n\tb=GBD+OSHL55u77MUPpPoKCTaHNbk7CN5a85p2oi1HPfr/2qhmqIivw3mCnk/JYreUIR\n\tioc97BqZtKYCy95a4vCgoMlNp0f5gGm7wemfJw5mhYeEmL+9iCIEcQn4nFDWT3bhuJAY\n\tcZSviqjk0AvOMx8wAPFEEYxi54iuZJOaxGF6Wb2jO5vlt1rkMEcaSnB87tyc9CX3sl6t\n\tQBIjiLqQqfxxzH7HyUBu2zSFGItfHD3RfQCasgtDeVNP4Ur3bp8HnCxllVqYSWRVCg/p\n\tuZYSXYmhaELI/CUCicSoFUB0HUClOsUypN03IOPBpDNd21H7d6TiPqFF/3IYxcPPHkbM\n\td4tA==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id;\n\tbh=0/qJRDMK9mltokw50pejplZpiLXN+pusGfrwz+sSuUk=;\n\tb=ALCx6Ltu5UzQgVohqdPXJjd9WFk46JUmLFrhyPiG03B2AY/Ehj8Y/vmnPJWRfFP1ow\n\tjl0GUNcqVPbeawkvjrkDWU3wciOs091/0AJ9m82bzxtp2GXPU3VDfjrUjCB2Z8+5+Jaf\n\tzBvINXZQL+C8RTgruKBRoECkd6qhRf0m0/lQIBKwaMOdvKvEiBhSMg+W2cDk3yFvq9m9\n\tiXCC75iu+t4pZlFduRPBvbB6pwlVENHMLVkkxcCTjpZcueIGf1aDcXjk+QbVYvL3gse7\n\tZd/O8K1F496pWLJ6FX1TB/1qOERdnAow6YC5BUMh8MZwMp4ABYkhPp27GYaAD1HyaSgh\n\tinPA==", "X-Gm-Message-State": "AMCzsaXaNJhPTSBUwPB92SeZEA3vkaainU8zksuTFlOOnwVLKX9c6HdW\n\tpeijBV6IuhA+xo1SfKXmMqVeuIK6", "X-Google-Smtp-Source": "ABhQp+S7muQo/q8S1/9hZfVpmrjPKV0Sq8ncpdTIcajbwAYRCofqkjNuGCvN9WjJYp2quf4HHiuIDA==", "X-Received": "by 10.101.81.10 with SMTP id f10mr1248313pgq.148.1509572492726; \n\tWed, 01 Nov 2017 14:41:32 -0700 (PDT)", "From": "Yi-Hung Wei <yihung.wei@gmail.com>", "To": "dev@openvswitch.org", "Date": "Wed, 1 Nov 2017 14:40:27 -0700", "Message-Id": "<1509572427-19204-1-git-send-email-yihung.wei@gmail.com>", "X-Mailer": "git-send-email 2.7.4", "X-Spam-Status": "No, score=0.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,\n\tDKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM\n\tautolearn=disabled version=3.3.1", "X-Spam-Checker-Version": "SpamAssassin 3.3.1 (2010-03-16) on\n\tsmtp1.linux-foundation.org", "Subject": "[ovs-dev] [PATCH] packets: Fix C++ compilation issues when include\n\tpackets.h", "X-BeenThere": "ovs-dev@openvswitch.org", "X-Mailman-Version": "2.1.12", "Precedence": "list", "List-Id": "<ovs-dev.openvswitch.org>", "List-Unsubscribe": "<https://mail.openvswitch.org/mailman/options/ovs-dev>,\n\t<mailto:ovs-dev-request@openvswitch.org?subject=unsubscribe>", "List-Archive": "<http://mail.openvswitch.org/pipermail/ovs-dev/>", "List-Post": "<mailto:ovs-dev@openvswitch.org>", "List-Help": "<mailto:ovs-dev-request@openvswitch.org?subject=help>", "List-Subscribe": "<https://mail.openvswitch.org/mailman/listinfo/ovs-dev>,\n\t<mailto:ovs-dev-request@openvswitch.org?subject=subscribe>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=\"us-ascii\"", "Content-Transfer-Encoding": "7bit", "Sender": "ovs-dev-bounces@openvswitch.org", "Errors-To": "ovs-dev-bounces@openvswitch.org" }, "content": "This patch fixes three C++ compilation errors when it includes\n\"lib/packets.h\".\n\n1) Fix in \"include/openvswitch/util.h\" is to avoid duplicated\nnamed_member__ in struct pkt_metadata.\n\n2) Fix in \"lib/packets.h\" is because designated initializers are not\nimplemented in GNU C++ [1].\n\n3) Fix in \"lib/util.h\" is because __builtin_types_compatible_p and\n__builtin_choose_expr are only supported in GCC. I use one solution\nfor C++ that is type-safe and works at compile time from [2].\n\n[1]: https://gcc.gnu.org/onlinedocs/gcc/Designated-Inits.html\n[2]: https://goo.gl/xNe48A\n\nSigned-off-by: Yi-Hung Wei <yihung.wei@gmail.com>\n---\n include/openvswitch/util.h | 12 ++++++------\n lib/packets.h | 4 +++-\n lib/util.h | 15 ++++++++++++++-\n 3 files changed, 23 insertions(+), 8 deletions(-)", "diff": "diff --git a/include/openvswitch/util.h b/include/openvswitch/util.h\nindex 84d7e07ff370..c3e60d56135b 100644\n--- a/include/openvswitch/util.h\n+++ b/include/openvswitch/util.h\n@@ -232,12 +232,12 @@ OVS_NO_RETURN void ovs_assert_failure(const char *, const char *, const char *);\n uint8_t PAD_ID[ROUND_UP(sizeof(struct { MEMBERS }), UNIT)]; \\\n }\n #else\n-#define PADDED_MEMBERS_CACHELINE_MARKER(UNIT, CACHELINE, MEMBERS) \\\n- union { \\\n- OVS_CACHE_LINE_MARKER CACHELINE; \\\n- struct { MEMBERS }; \\\n- struct { MEMBERS } named_member__; \\\n- uint8_t PAD_ID[ROUND_UP(sizeof named_member__, UNIT)]; \\\n+#define PADDED_MEMBERS_CACHELINE_MARKER(UNIT, CACHELINE, MEMBERS) \\\n+ union { \\\n+ OVS_CACHE_LINE_MARKER CACHELINE; \\\n+ struct { MEMBERS }; \\\n+ struct { MEMBERS } named_member_##CACHELINE; \\\n+ uint8_t PAD_ID[ROUND_UP(sizeof named_member_##CACHELINE, UNIT)]; \\\n }\n #endif\n \ndiff --git a/lib/packets.h b/lib/packets.h\nindex 705d0b270966..782fdd7c8bf8 100644\n--- a/lib/packets.h\n+++ b/lib/packets.h\n@@ -1093,7 +1093,9 @@ static inline bool ipv6_addr_is_multicast(const struct in6_addr *ip) {\n static inline struct in6_addr\n in6_addr_mapped_ipv4(ovs_be32 ip4)\n {\n- struct in6_addr ip6 = { .s6_addr = { [10] = 0xff, [11] = 0xff } };\n+ struct in6_addr ip6;\n+ memset(&ip6, 0, sizeof(ip6));\n+ ip6.s6_addr[10] = 0xff, ip6.s6_addr[11] = 0xff;\n memcpy(&ip6.s6_addr[12], &ip4, 4);\n return ip6;\n }\ndiff --git a/lib/util.h b/lib/util.h\nindex 764e0a08a429..3c43c2c355e2 100644\n--- a/lib/util.h\n+++ b/lib/util.h\n@@ -31,7 +31,7 @@\n extern char *program_name;\n \n #define __ARRAY_SIZE_NOCHECK(ARRAY) (sizeof(ARRAY) / sizeof((ARRAY)[0]))\n-#ifdef __GNUC__\n+#if __GNUC__ && !defined(__cplusplus)\n /* return 0 for array types, 1 otherwise */\n #define __ARRAY_CHECK(ARRAY) \t\t\t\t\t\\\n !__builtin_types_compatible_p(typeof(ARRAY), typeof(&ARRAY[0]))\n@@ -41,6 +41,19 @@ extern char *program_name;\n #define __ARRAY_SIZE(ARRAY)\t\t\t\t\t\\\n __builtin_choose_expr(__ARRAY_CHECK(ARRAY),\t\t\t\\\n __ARRAY_SIZE_NOCHECK(ARRAY), __ARRAY_FAIL(ARRAY))\n+#elif defined(__cplusplus)\n+#define __ARRAY_SIZE(ARRAY) ( \\\n+ 0 * sizeof(reinterpret_cast<const ::Bad_arg_to_ARRAY_SIZE *>(ARRAY)) + \\\n+ 0 * sizeof(::Bad_arg_to_ARRAY_SIZE::check_type((ARRAY), &(ARRAY))) + \\\n+ sizeof(ARRAY) / sizeof((ARRAY)[0]) )\n+\n+struct Bad_arg_to_ARRAY_SIZE {\n+ class Is_pointer;\n+ class Is_array {};\n+ template <typename T>\n+ static Is_pointer check_type(const T *, const T * const *);\n+ static Is_array check_type(const void *, const void *);\n+};\n #else\n #define __ARRAY_SIZE(ARRAY) __ARRAY_SIZE_NOCHECK(ARRAY)\n #endif\n", "prefixes": [ "ovs-dev" ] }