All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard PALO <richard at netbsd.org>
To: devel@acpica.org
Subject: Re: [Devel] PATCH proposal removing use of strtoul in events/evgpeinit.c
Date: Fri, 11 Sep 2015 17:36:26 +0200	[thread overview]
Message-ID: <55F2F4FA.3030504@netbsd.org> (raw)
In-Reply-To: 94F2FBAB4432B54E8AACC7DFDE6C92E37D344574@ORSMSX112.amr.corp.intel.com

[-- Attachment #1: Type: text/plain, Size: 2083 bytes --]

Le 11/09/15 16:57, Moore, Robert a écrit :
> Not to mention that every compiler is different, and you need to put your own "ignore error" types of things in your platform-specific or compiler-specific header. Such is the price of attempting to build OS- and compiler-independent code.
> 

>>> not to mention kludge needed when linting global crosschecks in the
>>> illumos gate, for the later
>>>> "/home/richard/src/illumos-gate/usr/src/common/acpica/components/dis
>>>> pa tcher/dsobject.c", line 351: warning: function returns value
>>>> which is sometimes ignored: memcpy (E_FUNC_RET_MAYBE_IGNORED2)
>>>> "/home/richard/src/illumos-gate/usr/src/common/acpica/components/dis
>>>> pa tcher/dsutils.c", line 608: warning: function returns value which
>>>> is sometimes ignored: strncpy (E_FUNC_RET_MAYBE_IGNORED2)
>>>> "/home/richard/src/illumos-gate/usr/src/common/acpica/components/exe
>>>> cu ter/exmisc.c", line 370: warning: function returns value which is
>>>> sometimes ignored: strcpy (E_FUNC_RET_MAYBE_IGNORED2)
>>>> "/home/richard/src/illumos-gate/usr/src/common/acpica/components/exe
>>>> cu ter/exnames.c", line 224: warning: function returns value which
>>>> is sometimes ignored: strcat (E_FUNC_RET_MAYBE_IGNORED2)
>>>

? Sorry, I guess I don't follow. for example, posix, and various c standards define memcpy as 
>  void *memcpy(void *restrict s1, const void *restrict s2, size_t n);

the first reference above, components/dispatcher/dsobject.c does:

> 349         if (ByteList)
> 350         {
> 351             memcpy (ObjDesc->Buffer.Pointer, ByteList->Named.Data,
> 352                          ByteListLength);
> 353         }

what would make most static analyzers happy is a simple void cast -- (void) memcpy(...)

Then, at least, ignoring the return value is explicit instead of possibly 
just being forgotten.. 

This should also be the most portable form of C (at least for the cases at hand).

There are numerous examples of this sort of thing over and above what I listed above...

cheers,
-- 
Richard PALO


             reply	other threads:[~2015-09-11 15:36 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-11 15:36 Richard PALO [this message]
  -- strict thread matches above, loose matches on Subject: below --
2015-09-11 15:49 [Devel] PATCH proposal removing use of strtoul in events/evgpeinit.c Moore, Robert
2015-09-11 14:57 Moore, Robert
2015-09-11 14:53 Moore, Robert
2015-09-11 10:56 Richard PALO
2015-09-09 18:01 Moore, Robert
2015-09-09 18:00 Moore, Robert
2015-09-05  6:01 Richard PALO
2015-09-04 13:58 Moore, Robert
2015-09-04 11:12 Richard PALO

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=55F2F4FA.3030504@netbsd.org \
    --to=devel@acpica.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.