Powered by Linux
Re: Re: Re: Re: Re: Re: Re: Re: Re: about using smatch in all debian C code — Semantic Matching Tool

Re: Re: Re: Re: Re: Re: Re: Re: Re: about using smatch in all debian C code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Dan, please ignore my previous two e-mails, which are summarized in this one. The current situation is as follows:
I went directly into the NtyCo subdirectory NtyCo/core, changed the gcc to cgcc in the makefile and ran: 

 sudo make 

the output (sparse show me the warnings) :

/home/lsc20011130/smatch/cgcc -c nty_epoll.c -o /nty_epoll.o  
/home/lsc20011130/smatch/cgcc -c nty_coroutine.c -o /nty_coroutine.o  
nty_coroutine.c:258:6: warning: symbol 'nty_coroutine_renice' was not declared. Should it be static?
nty_coroutine.c:279:6: warning: symbol 'nty_coroutine_detach' was not declared. Should it be static?
/home/lsc20011130/smatch/cgcc -c nty_socket.c -o /nty_socket.o  
nty_socket.c:421:9: error: symbol 'recvfrom' redeclared with different type (originally declared at /usr/include/sys/socket.h:163) - incompatible argument 5 (different base types)
nty_socket.c:504:9: error: symbol 'sendto' redeclared with different type (originally declared at /usr/include/sys/socket.h:152) - incompatible argument 5 (different base types)
nty_socket.c:529:5: error: symbol 'accept' redeclared with different type (originally declared at /usr/include/sys/socket.h:232) - incompatible argument 2 (different base types)
nty_socket.c:579:5: error: symbol 'connect' redeclared with different type (originally declared at /usr/include/sys/socket.h:126) - incompatible argument 2 (different base types)
/home/lsc20011130/smatch/cgcc -c nty_schedule.c -o /nty_schedule.o  
nty_schedule.c:82:1: warning: symbol '_nty_coroutine_rbtree_sleep_RB_INSERT_COLOR' was not declared. Should it be static?
nty_schedule.c:82:1: warning: symbol '_nty_coroutine_rbtree_sleep_RB_REMOVE_COLOR' was not declared. Should it be static?
nty_schedule.c:82:1: warning: symbol '_nty_coroutine_rbtree_sleep_RB_REMOVE' was not declared. Should it be static?
nty_schedule.c:82:1: warning: symbol '_nty_coroutine_rbtree_sleep_RB_INSERT' was not declared. Should it be static?
nty_schedule.c:82:1: warning: symbol '_nty_coroutine_rbtree_sleep_RB_FIND' was not declared. Should it be static?
nty_schedule.c:82:1: warning: symbol '_nty_coroutine_rbtree_sleep_RB_NFIND' was not declared. Should it be static?
nty_schedule.c:82:1: warning: symbol '_nty_coroutine_rbtree_sleep_RB_NEXT' was not declared. Should it be static?
nty_schedule.c:82:1: warning: symbol '_nty_coroutine_rbtree_sleep_RB_PREV' was not declared. Should it be static?
nty_schedule.c:82:1: warning: symbol '_nty_coroutine_rbtree_sleep_RB_MINMAX' was not declared. Should it be static?
nty_schedule.c:83:1: warning: symbol '_nty_coroutine_rbtree_wait_RB_INSERT_COLOR' was not declared. Should it be static?
nty_schedule.c:83:1: warning: symbol '_nty_coroutine_rbtree_wait_RB_REMOVE_COLOR' was not declared. Should it be static?
nty_schedule.c:83:1: warning: symbol '_nty_coroutine_rbtree_wait_RB_REMOVE' was not declared. Should it be static?
nty_schedule.c:83:1: warning: symbol '_nty_coroutine_rbtree_wait_RB_INSERT' was not declared. Should it be static?
nty_schedule.c:83:1: warning: symbol '_nty_coroutine_rbtree_wait_RB_FIND' was not declared. Should it be static?
nty_schedule.c:83:1: warning: symbol '_nty_coroutine_rbtree_wait_RB_NFIND' was not declared. Should it be static?
nty_schedule.c:83:1: warning: symbol '_nty_coroutine_rbtree_wait_RB_NEXT' was not declared. Should it be static?
nty_schedule.c:83:1: warning: symbol '_nty_coroutine_rbtree_wait_RB_PREV' was not declared. Should it be static?
nty_schedule.c:83:1: warning: symbol '_nty_coroutine_rbtree_wait_RB_MINMAX' was not declared. Should it be static?
nty_schedule.c:122:34: warning: missing braces around initializer
nty_schedule.c:121:15: warning: symbol 'nty_schedule_search_wait' was not declared. Should it be static?
nty_schedule.c:135:34: warning: missing braces around initializer
nty_schedule.c:181:6: warning: symbol 'nty_schedule_cancel_wait' was not declared. Should it be static?
nty_schedule.c:185:6: warning: symbol 'nty_schedule_free' was not declared. Should it be static?
nty_schedule.c:201:5: warning: symbol 'nty_schedule_create' was not declared. Should it be static?

but if I run :
 sudo make CHECK="/home/lsc20011130/smatch/smatch --info", instead of sudo make 
the output (all the waring disappear):

/home/lsc20011130/smatch/cgcc -c nty_epoll.c -o /nty_epoll.o  
/home/lsc20011130/smatch/cgcc -c nty_coroutine.c -o /nty_coroutine.o  
/home/lsc20011130/smatch/cgcc -c nty_socket.c -o /nty_socket.o  
/home/lsc20011130/smatch/cgcc -c nty_schedule.c -o /nty_schedule.o  

I would like to know if this is normal? I'm not familiar with static analysis, so forgive me if I ask some simple and silly questions.
 


"李书畅" <lishuchang@xxxxxxxxxxx>写道:
> I put some obvious errors in the code and add --info to smatch, 
> but the output does't change at all :
> 
> if [ ! -d "objs" ]; then \
>         mkdir -p objs; \\
> mkdir -p objs; \\
> if [ ! -d "bin" ]; then \ \
>         mkdir -p bin; \ \
> mkdir -p bin; \fi
> core/
> make -C core/
> make[1]: Entering directory '/home/lsc20011130/NtyCo/core'
> /home/lsc20011130/smatch/cgcc -c nty_epoll.c -o /home/lsc20011130/NtyCo/objs/nty_epoll.o -lpthread -O3 -ldl -I /home/lsc20011130/NtyCo/core  
> /home/lsc20011130/smatch/cgcc -c nty_coroutine.c -o /home/lsc20011130/NtyCo/objs/nty_coroutine.o -lpthread -O3 -ldl -I /home/lsc20011130/ NtyCo/core  
> /home/lsc20011130/smatch/cgcc -c nty_socket.c -o /home/lsc20011130/NtyCo/objs/nty_socket.o -lpthread -O3 -ldl -I /home/lsc20011130/NtyCo/core core  
> /home/lsc20011130/smatch/cgcc -c nty_schedule.c -o /home/lsc20011130/NtyCo/objs/nty_schedule.o -lpthread -O3 -ldl -I /home/lsc20011130/ NtyCo/core  
> make[1]: Leaving directory '/home/lsc20011130/NtyCo/core'
> ar rcs libntyco.a /home/lsc20011130/NtyCo/objs/nty_socket.o /home/lsc20011130/NtyCo/objs/nty_coroutine.o /home/lsc20011130/NtyCo/objs/ nty_epoll.o /home/lsc20011130/NtyCo/objs/nty_schedule.o
> 
> Sparse is clearly not working, I'm confused.
> 
> regards,
> Lishu Chang
> 
> "李书畅" <lishuchang@xxxxxxxxxxx>写道:
> > I realized that my previous statement was wrong. 
> > In this case, as I tried : make CHECK="/home/lsc20011130/smatch/smatch" CC=/home/lsc20011130/smatch/cgcc,
> > the output is:
> > 
> > if [ ! -d "objs" ]; then \
> >         mkdir -p objs; \\
> > mkdir -p objs; \\
> > if [ ! -d "bin" ]; then \ \
> >         mkdir -p bin; \ \
> > mkdir -p bin; \fi
> > core/
> > make -C core/
> > make[1]: Entering directory '/home/lsc20011130/NtyCo/core'
> > /home/lsc20011130/smatch/cgcc -c nty_epoll.c -o /home/lsc20011130/NtyCo/objs/nty_epoll.o -lpthread -O3 -ldl -I /home/lsc20011130/NtyCo/core  
> > /home/lsc20011130/smatch/cgcc -c nty_coroutine.c -o /home/lsc20011130/NtyCo/objs/nty_coroutine.o -lpthread -O3 -ldl -I /home/lsc20011130/ NtyCo/core  
> > /home/lsc20011130/smatch/cgcc -c nty_socket.c -o /home/lsc20011130/NtyCo/objs/nty_socket.o -lpthread -O3 -ldl -I /home/lsc20011130/NtyCo/core core  
> > /home/lsc20011130/smatch/cgcc -c nty_schedule.c -o /home/lsc20011130/NtyCo/objs/nty_schedule.o -lpthread -O3 -ldl -I /home/lsc20011130/ NtyCo/core  
> > make[1]: Leaving directory '/home/lsc20011130/NtyCo/core'
> > ar rcs libntyco.a /home/lsc20011130/NtyCo/objs/nty_socket.o /home/lsc20011130/NtyCo/objs/nty_coroutine.o /home/lsc20011130/NtyCo/objs/ nty_epoll.o /home/lsc20011130/NtyCo/objs/nty_schedule.o
> > 
> > cgcc runs, but sparse doesn't seem to work successfully.
> > 
> > regards,
> > Lishu Chang
> > 
> > 
> > > -----原始邮件-----
> > > 发件人: "Dan Carpenter" <dan.carpenter@xxxxxxxxxx>
> > > 发送时间: 2024-03-11 13:00:42 (星期一)
> > > 收件人: "李书畅" <lishuchang@xxxxxxxxxxx>
> > > 抄送: smatch@xxxxxxxxxxxxxxx
> > > 主题: Re: Re: Re: Re: Re: Re: about using smatch in all debian C code
> > > 
> > > On Sun, Mar 10, 2024 at 01:39:41PM +0800, 李书畅 wrote:
> > > > I figure it out, I tried 
> > > > CHECK="/home/lsc20011130/smatch/smatch /home/lsc20011130/NtyCo/core" CC=/home/lsc20011130/smatch/cgcc make , and it works fine.
> > > > 
> > > 
> > > I don't think you want to add the "/home/lsc20011130/NtyCo/core" part...
> > > 
> > > But I'm happy that it's working.  Don't hesitate to ask if you run into
> > > more issues.
> > > 
> > > regards,
> > > dan carpenter




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux