Re: No type checking in ctype builtins

2022-04-28 Thread Eric Gallager via Gcc
On Wed, Apr 27, 2022 at 12:20 PM Jonathan Wakely via Gcc wrote: > > On Wed, 27 Apr 2022 at 16:29, Andrea Monaco via Gcc wrote: > > > > > > This program > > > > #include > > > > int main () > > { > > char *s; > > isspace (s); > > } > > > > compiles with no warning in gcc 8.3.0, ev

Re: No type checking in ctype builtins

2022-04-28 Thread Florian Weimer via Gcc
* Andreas Schwab: > On Apr 27 2022, Andrea Monaco via Gcc wrote: > >> This program >> >> #include >> >> int main () >> { >> char *s; >> isspace (s); >> } >> >> compiles with no warning in gcc 8.3.0, even though there's a type >> mistake; the correct call would be isspace (*s). > >

Re: No type checking in ctype builtins

2022-04-27 Thread Andrea Monaco via Gcc
> Try -Wsystem-headers. You're right. That showed a warning. > You need to suppress the macro to get the builtin. That means a macro expansion takes precedence over a builtin function substitution, if I understand correctly. It makes sense, because preprocessing happens before compilati

Re: No type checking in ctype builtins

2022-04-27 Thread Jonathan Wakely via Gcc
On Wed, 27 Apr 2022 at 16:29, Andrea Monaco via Gcc wrote: > > > This program > > #include > > int main () > { > char *s; > isspace (s); > } > > compiles with no warning in gcc 8.3.0, even though there's a type > mistake; the correct call would be isspace (*s). N.B. The correct c

Re: No type checking in ctype builtins

2022-04-27 Thread Andreas Schwab
On Apr 27 2022, Andrea Monaco via Gcc wrote: > This program > > #include > > int main () > { > char *s; > isspace (s); > } > > compiles with no warning in gcc 8.3.0, even though there's a type > mistake; the correct call would be isspace (*s). Try -Wsystem-headers. > The ctype f

No type checking in ctype builtins

2022-04-27 Thread Andrea Monaco via Gcc
This program #include int main () { char *s; isspace (s); } compiles with no warning in gcc 8.3.0, even though there's a type mistake; the correct call would be isspace (*s). The ctype functions are implemented as macros in glibc, so you can't have type checking. But they ar