Re: proposal: remove traditional C support from lint

Thomas Klausner <[email protected]>
Newsgroups gmane.os.netbsd.devel.toolchain
Message-ID <[email protected]>
On Thu, Mar 18, 2021 at 09:38:22AM +0000, nia wrote:
> On Thu, Mar 18, 2021 at 09:01:47AM +0100, Roland Illig wrote:
> > Another thing is to check for GNU-specific C features such as
> > __FUNCTION__ (which is easy to avoid in C99), ({...}), array
> > initialization with [a...b], and so on.  I don't think even GCC can
> > reliably detect these.
> 
> Doesn't lint currently fail to check C on NetBSD unless you enable
> GNU extensions (-g) and "C9X mode" (-S)? I found it would always error
> on the system headers, which is really confusing default behaviour,
> especially on a BSD system where the system is supposed to be developed
> as a single unit.

Thanks for the hint!

I recently tried lint on some C code I'm developing, but didn't get very far:

lint -I ... file.c

cdefs.h(687): syntax error 'long' [249]
cdefs.h(688): syntax error 'unsigned' [249]
stdio.h(239): syntax error '__attribute__' [249]
stdio.h(246): syntax error '__attribute__' [249]
stdio.h(254): syntax error '__attribute__' [249]
stdio.h(261): syntax error '__attribute__' [249]
stdio.h(265): syntax error '__attribute__' [249]
stdio.h(265): cannot recover from previous errors [224]

lint -g -I ... file.c is better but still gives me warnings I can't do anything about:

pthread_types.h(128): warning: anonymous struct/union members is a C9X feature [49]
inttypes.h(66): warning: struct _locale never defined [233]
ansi.h(51): warning: struct __tag_wctrans_t never defined [233]
ansi.h(54): warning: struct __tag_wctype_t never defined [233]
types.h(323): warning: struct kauth_cred never defined [233]
pthread_types.h(61): warning: struct __pthread_st never defined [233]
pthread_types.h(70): warning: struct __pthread_spin_st never defined [233]
time.h(146): warning: struct sigevent never defined [233]
time.h(198): warning: struct __state never defined [233]

with -S, one more warning is removed, but still a lot remain:

inttypes.h(66): warning: struct _locale never defined [233]
ansi.h(51): warning: struct __tag_wctrans_t never defined [233]
ansi.h(54): warning: struct __tag_wctype_t never defined [233]
types.h(323): warning: struct kauth_cred never defined [233]
pthread_types.h(61): warning: struct __pthread_st never defined [233]
pthread_types.h(70): warning: struct __pthread_spin_st never defined [233]
time.h(146): warning: struct sigevent never defined [233]
time.h(198): warning: struct __state never defined [233]

NetBSD 9.99.81/amd64 from March 10.
 Thomas
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.