From patchwork Tue Nov 21 12:20:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 24398 Received: (qmail 47726 invoked by alias); 21 Nov 2017 12:20:25 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 47709 invoked by uid 89); 21 Nov 2017 12:20:24 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.2 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_NUMSUBJECT, KAM_SHORT, KB_WAM_FROM_NAME_SINGLEWORD, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=bracket, universal, HContent-Transfer-Encoding:8bit X-HELO: mail-qt0-f194.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=IYkNAqWRcWawCSTw5kz7Y59KNdWQar0kTsUmzv0gW/s=; b=fNpia5wGWoK3udSi2yXj/jBtM/W0HcU28wFNoChv/I8em6XhJ9F4MpYKxKVNAV5RgR /2UFiR8bqXI5qNTn8ShW+Qk4l6gtPI427T4Fc56ffjDviPNjppyh5jmJnn/nELuWH23Y C3lUEkfxs9uCA0+1qH0FVlEhUYTULvoEv0c0v005+sMw7MdriiyflFoTegdsMiRQVLxc 4r/yZIXj1D+ZhVOd1O4XJ8nJML9nt1wTtTLdY3ZAIjtnvhPk3TIEGTjPnkLx1fqXNXdp 6Mo2kWf4YjR19nniS9GD7mkyzSIFstp2ja3XkMenjbsiPQDAM8YV4BV0JAkzxAFisNEC 5CDw== X-Gm-Message-State: AJaThX47k0vbRQ58ZffXP+lG1RI6KayBYdBB2MUv8Ly4A43xipWYijQN /akJ3yIAsiXtfz4xr1G+bCD24Xdumss= X-Google-Smtp-Source: AGs4zMZ7wW7r5VqG9+4a+JoARZPimnweS3zzurYJ/VoO3o6Y+XnfRYzgDzpiMl6LdU98qst3y9F/PQ== X-Received: by 10.200.49.166 with SMTP id h35mr25983291qte.293.1511266820605; Tue, 21 Nov 2017 04:20:20 -0800 (PST) From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH] nptl: Add workaround for ASSERT_PTHREAD_INTERNAL_SIZE with GCC 4.9 Date: Tue, 21 Nov 2017 10:20:13 -0200 Message-Id: <1511266813-5215-1-git-send-email-adhemerval.zanella@linaro.org> MIME-Version: 1.0 GCC 4.9 (the minimum current supported) emits an warning for universal zero initializer ({0}) on ASSERT_PTHREAD_INTERNAL_SIZE: pthread_attr_init.c: In function ‘__pthread_attr_init_2_1’: pthread_attr_init.c:37:3: error: missing braces around initializer [-Werror=missing-braces] ASSERT_PTHREAD_INTERNAL_SIZE (pthread_attr_t, struct pthread_attr); ^ pthread_attr_init.c:37:3: error: (near initialization for ‘(anonymous).__size’) [-Werror=missing-braces] It is fact GCC BZ#53119 [1] fixed in later version (GCC5+). Since current branch is closed and there is no indication it will be backports (comment #20 in same bug report) this patch fixes by using a double bracket to zero initialize the struct. Checked on x86_64-linux-gnu with GCC 7 and GCC 4.9. * nptl/pthreadP.h (ASSERT_PTHREAD_INTERNAL_SIZE): Add workarond for -Wmissing-braces on GCC 4.9. [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53119 Signed-off-by: Adhemerval Zanella --- ChangeLog | 5 +++++ nptl/pthreadP.h | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/nptl/pthreadP.h b/nptl/pthreadP.h index 1cc80b6..713000e 100644 --- a/nptl/pthreadP.h +++ b/nptl/pthreadP.h @@ -644,7 +644,7 @@ check_stacksize_attr (size_t st) "sizeof (" #type ") != " #size) #define ASSERT_PTHREAD_INTERNAL_SIZE(type, internal) \ - _Static_assert (sizeof ((type) { 0 }).__size >= sizeof (internal), \ + _Static_assert (sizeof ((type) { { 0 } }).__size >= sizeof (internal),\ "sizeof (" #type ".__size) < sizeof (" #internal ")") #define ASSERT_PTHREAD_STRING(x) __STRING (x)