Page MenuHomeFreeBSD

Set __unused to silence CLANG warning.
ClosedPublic

Authored by araujo on May 31 2015, 5:45 AM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Mar 9, 12:31 PM
Unknown Object (File)
Tue, Mar 3, 9:42 AM
Unknown Object (File)
Tue, Mar 3, 9:26 AM
Unknown Object (File)
Tue, Mar 3, 1:46 AM
Unknown Object (File)
Feb 8 2026, 8:46 AM
Unknown Object (File)
Feb 7 2026, 6:36 PM
Unknown Object (File)
Feb 7 2026, 4:33 PM
Unknown Object (File)
Jan 31 2026, 5:08 AM
Subscribers

Details

Summary

The variable is not used, but as I'm not very familiar with the code and it might be used only for nvlist_get_number function. Better only silence it instead of remove.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

araujo retitled this revision from to Set __unused to silence CLANG warning..
araujo updated this object.
araujo edited the test plan for this revision. (Show Details)
araujo added reviewers: rodrigc, oshogbo.
rodrigc edited edge metadata.

I think the flags should just be removed, and not bother with __unused.
However, I think @pjd should review this and comment.
@pjd what do you think?

araujo edited edge metadata.

After receive the feedback of @rodrigc and @oshogbo, I double read the code, and seems we can remove this variable without problems. I will wait @pjd review anyway.

I also reanalyze the code and if we want to remove nvlist_get_number bather is just to remove the flags variable.
But in other hand we also have zygote_clone function which is prepared to get some flags, so in my opinion we should do one of two things:
1* Remove the flags variable also from zygote_clone function.
2* Leave it as it is, because I think its quite good practice to get all variables which you send. It will be easier then to add some flags if we ever need it in zygote.

I think zygote_clone() is a different case, as it receives flags as a parameter and pass it to nvlist_add_number(), not the same case as zygote_main().

If my understand is correctly its look like:

  • zygote_main() is waiting on socket
  • zygote_clone() is called somewhere in code and it send nvlist (nvlist_xfer(3) function) over socket to the zygote_main() function
  • this nvlist which is sent contains flags, which are get by call you removed (nvlist_get_number(3) in line 147)
  • flags in zygote_clone function are always 0

In my opinion if you want to remove flags which are currently unused you should remove them from sender and receiver.

I have update the patch as you mention @oshogbo, I made more tests too and the flags is always 0. However I went through the revision r282346 where did you add flags at nvlist_recv().

So in this case, could you double review this patch?

All the best.

Update the patch again, the last update took things not related with this review. Sorry!

oshogbo edited edge metadata.

It's looks good for me, if @pjd don't have other plan to this flags variable :)

This revision is now accepted and ready to land.Jun 3 2015, 8:21 AM