[Bug 281768] [PATCH] stdio.h: don't expose rsize_t unless __EXT1_VISIBLE

[email protected]
Newsgroups gmane.os.freebsd.devel.standards
Message-ID <[email protected]/bugzilla/>
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=281768

            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: [email protected]
          Reporter: [email protected]

Created attachment 253899
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=253899&action=edit
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 
#include <stdio.h>
typedef int rsize_t;
$ c99 -c conflict.c 
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:
 
https://github.com/freebsd/freebsd-src/commit/c13559d31e90a8c405771be36ab9ccfa41d4ebd6

- 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

-- 
You are receiving this mail because:
You are the assignee for the bug.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.