Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 30 Sep 2024 01:36:40 +0000
From:      bugzilla-noreply@freebsd.org
To:        standards@FreeBSD.org
Subject:   [Bug 281768] [PATCH] stdio.h: don't expose rsize_t unless __EXT1_VISIBLE
Message-ID:  <bug-281768-99@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D281768

            Bug ID: 281768
           Summary: [PATCH] stdio.h: don't expose rsize_t unless
                    __EXT1_VISIBLE
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: standards
          Assignee: standards@FreeBSD.org
          Reporter: gperciva@tarsnap.com

Created attachment 253899
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D253899&action=
=3Dedit
stdio.h: don't expose rsize_t unless __EXT1_VISIBLE

<stdio.h> should not unconditionally declare rsize_t; this patch fixes that=
 by
wrapping the typedef inside an `#if __EXT1_VISIBLE`, which is how it's done=
 in
<stddef.h>, <stdlib.h>, and <string.h>.

In C99, rsize_t is not a reserved identifier.  (POSIX reserves *_t, but in =
C99,
there's no global *_t reservation; only int*_t and uint*_t in <stdint.h>.)

As such, technically speaking this should compile:

```
$ cat conflict.c=20
#include <stdio.h>
typedef int rsize_t;
$ c99 -c conflict.c=20
conflict.c:2:13: error: typedef redefinition with different types ('int' vs
'size_t' (aka 'unsigned long'))
    2 | typedef int rsize_t;
      |             ^
/usr/include/stdio.h:55:16: note: previous definition is here
   55 | typedef size_t rsize_t;
      |                ^
1 error generated.
```

Related history:
- Problematic commit:
=20
https://github.com/freebsd/freebsd-src/commit/c13559d31e90a8c405771be36ab9c=
cfa41d4ebd6

- Good example: adding `typedef size_t rsize_t;` to <stddef.h> and <stdlib.=
h>
  as part of memset_s addition
  https://reviews.freebsd.org/D9903

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-281768-99>