From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by sourceware.org (Postfix) with ESMTPS id 48FD7385840D for ; Sat, 20 Nov 2021 16:47:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 48FD7385840D Received: by mail-wm1-x329.google.com with SMTP id j140-20020a1c2392000000b003399ae48f58so5084452wmj.5 for ; Sat, 20 Nov 2021 08:47:30 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:from:to:cc:references:in-reply-to :content-transfer-encoding; bh=meHDZWxEEm1v4WjXJbEHMMH8tEsWbiIJ8f74uTe4zPA=; b=zLcY2Wu6EgYGYMWQ1OikJkim2MN+JRBAPoEPEgOio5B4CIzUw6aBiUsoTwyCbgS+dt rJ5iQrL6vx/4uAVGqjIj9RIhmg1+MkieyTgucHDiKryFytHPXqMuaPXK90EiU9naFuwc /KLVdO+NmHuk096N4KcPHcJdC+GI11JWqTtMAw1tK0QXueM3pkY7yZUhqAl3cckwicCV NDLfF0lh/jTktdHgicpnp3Y/5a/RO7yYbeaqlJIt0IsH0mAxQySE+2JzgG8MtSo1wzho CVmyzYIfkl77PAsZ5pq5zspjrwUF1pAyeUHnDrT9lRLykRpIy75eF2IS/+OVJtjYl8Lt fwdA== X-Gm-Message-State: AOAM530yeB4o1r00G36sbmxrW40Y6SDrLBbEWno8LyIwaYS7IboV5lB1 GuIFGPwQZOsB4q+2uGOFnkY= X-Google-Smtp-Source: ABdhPJwZUgadOufW0vKmcxDZfQWNgSw5H+hlErjhK6RY2UFMtQm5gLauILorjIXZlFEsdRbtGOkJNA== X-Received: by 2002:a05:600c:3b28:: with SMTP id m40mr11862677wms.100.1637426849335; Sat, 20 Nov 2021 08:47:29 -0800 (PST) Received: from [10.168.10.170] ([170.253.36.171]) by smtp.gmail.com with ESMTPSA id f133sm3349138wmf.31.2021.11.20.08.47.28 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 20 Nov 2021 08:47:29 -0800 (PST) Message-ID: Date: Sat, 20 Nov 2021 17:47:28 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.3.0 Subject: Ping: ISO C3X proposal: nonnull qualifier Content-Language: en-US From: "Alejandro Colomar (man-pages)" To: cfe-dev@lists.llvm.org, Arthur O'Dwyer , Joerg Sonnenberger Cc: gcc@gcc.gnu.org, Joseph Myers References: <56a1a945-608e-0e5e-7610-c35481abb980@gmail.com> <4883fa8c-2d99-2611-a8e2-6c7612283da4@gmail.com> <79b4ef92-38a9-b8ba-6259-f8ade53880ca@gmail.com> In-Reply-To: <79b4ef92-38a9-b8ba-6259-f8ade53880ca@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.0 required=5.0 tests=BAYES_00, BODY_8BITS, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Nov 2021 16:47:32 -0000 Ping On 11/17/21 01:06, Alejandro Colomar (man-pages) wrote: > Hi, > > Sorry for Clang people, > when I started this thread, > I wasn't subscribed to your list, > and some messages are not on your list. > You can find the complete thread on the GCC list: > > > I have a few questions for you. > See below, please. > > On 11/16/21 13:34, Alejandro Colomar (man-pages) wrote: >> $ cat _Nonnull.c >> #include >> >> int *_Nonnull f(int *_Nullable p) >> { >>      if (!p) >>          exit(1); >>      return p; >> } >> >> >> - I get a warning from f(). >>    Ideally, >>    a programmer should not need to cast >>    (casts are dangerous), >>    to convert a nullable pointer to a _Nonnull pointer. >>    For that, >>    appropriate checks should be in the preceeding code. >>    Otherwise, a diagnostic should be issued. >>    To be on the safe side, >>    if a compiler has doubts, >>    it should diagnose. >> >>    There's some Clang document that talks about something similar. >>    I don't know its validity, >>    or if it was a draft before _Nonnull qualifiers. >>    > > That document suggests that I shouldn't get a diagnostic from f(). > Why did I get a diagnostic?  (I tried clang 11, 13 & 14(experimental)) > > > Is it talking about a different nonnull attribute/qualifier? > Was it about a proposal prior to the current _Nonnull? > Why is it not in use?  Was it too difficult to implement? > > > Do you think Clang could be improved to not warn on f()? > > > Thanks, > Alex > -- Alejandro Colomar Linux man-pages comaintainer; http://www.kernel.org/doc/man-pages/ http://www.alejandro-colomar.es/