public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "gjover at sipwise dot com" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sourceware.org
Subject: [Bug libc/27885] New: _Static_assert fallback definition in <sys/cdefs.h> triggers a lgtm.com alert
Date: Tue, 18 May 2021 12:28:51 +0000	[thread overview]
Message-ID: <bug-27885-131@http.sourceware.org/bugzilla/> (raw)

https://sourceware.org/bugzilla/show_bug.cgi?id=27885

            Bug ID: 27885
           Summary: _Static_assert fallback definition in <sys/cdefs.h>
                    triggers a lgtm.com alert
           Product: glibc
           Version: 2.34
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libc
          Assignee: unassigned at sourceware dot org
          Reporter: gjover at sipwise dot com
                CC: drepper.fsp at gmail dot com
  Target Milestone: ---

The fallback definition for _Static_assert in <sys/cdefs.h>, which is currently
(as of git HEAD glibc-2.33.9000-613-g4d4bb451d5f):

  #if (!defined _Static_assert && !defined __cplusplus \
       && (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) < 201112 \
       && (!__GNUC_PREREQ (4, 6) || defined __STRICT_ANSI__))
  # define _Static_assert(expr, diagnostic) \
      extern int (*__Static_assert_function (void)) \
        [!!sizeof (struct { int __error_if_negative: (expr) ? 2 : -1; })]
  #endif

causes the lgtm.com analyzer to trigger, on code using that keyword, the
following alert:

  https://lgtm.com/rules/1506024027114/

which is described as:

  Ambiguously signed bit-field member

  Bit fields with integral types should have explicit signedness only. For 
  example, use `unsigned int` rather than `int`. It is implementation specific 
  whether an `int`-typed bit field is signed, so there could be unexpected sign 
  extension or overflow.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

             reply	other threads:[~2021-05-18 12:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-18 12:28 gjover at sipwise dot com [this message]
2023-07-03  1:53 ` [Bug libc/27885] " ppluzhnikov at google dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-27885-131@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).