Bug 212724 - function signatures in man page missing the "restrict" keyword
Summary: function signatures in man page missing the "restrict" keyword
Status: New
Alias: None
Product: Documentation
Classification: Unclassified
Component: Manual Pages (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-bugs (Nobody)
Depends on:
Reported: 2016-09-16 09:30 UTC by Ori Avtalion
Modified: 2018-04-10 19:46 UTC (History)
1 user (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Ori Avtalion 2016-09-16 09:30:08 UTC
When a function has the "restrict" keyword, it is usually mentioned in the manpage.

Some man pages omit it. For example, strtok:

strok has the signature [1]:

  char *strtok(char * __restrict, const char * __restrict);

The manpage lists it as [2]:
  char * strtok(char *str, const char *sep);

It should be:
  char * strtok(char * restrict str, const char * restrict sep);

[1] https://github.com/freebsd/freebsd/blob/b8aaa2c367f1038f28506521674b9b40b8a51352/include/string.h#L119
[2] https://github.com/freebsd/freebsd/blob/b8aaa2c367f1038f28506521674b9b40b8a51352/lib/libc/string/strtok.3#L58

A few other functions in string.h that use "restrict", but omit it in their man pages:
* memccpy
* memcpy
* stpcpy
* stpncpy
* strlcat
* strncat
* strncpy

memcpy is interesting: Its documentation says it uses bcopy, and therefore the strings may overlap. However, the signature in string.h includes the "restrict" keywords.