€•a2Œsphinx.addnodes”Œdocument”“”)�”}”(Œ rawsource”Œ”Œchildren”]”(Œ translations”Œ LanguagesNode”“”)�”}”(hhh]”(hŒ pending_xref”“”)�”}”(hhh]”Œdocutils.nodes”ŒText”“”ŒChinese (Simplified)”…”�”}”Œparent”hsbaŒ attributes”}”(Œids”]”Œclasses”]”Œnames”]”Œdupnames”]”Œbackrefs”]”Œ refdomain”Œstd”Œreftype”Œdoc”Œ reftarget”Œ$/translations/zh_CN/dev-tools/sparse”Œmodname”NŒ classname”NŒ refexplicit”ˆuŒtagname”hhh ubh)�”}”(hhh]”hŒChinese (Traditional)”…”�”}”hh2sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ$/translations/zh_TW/dev-tools/sparse”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒItalian”…”�”}”hhFsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ$/translations/it_IT/dev-tools/sparse”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒJapanese”…”�”}”hhZsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ$/translations/ja_JP/dev-tools/sparse”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒKorean”…”�”}”hhnsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ$/translations/ko_KR/dev-tools/sparse”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒPortuguese (Brazilian)”…”�”}”hh‚sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ$/translations/pt_BR/dev-tools/sparse”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒSpanish”…”�”}”hh–sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ$/translations/sp_SP/dev-tools/sparse”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubeh}”(h]”h ]”h"]”h$]”h&]”Œcurrent_language”ŒEnglish”uh1h hhŒ _document”hŒsource”NŒline”NubhŒcomment”“”)�”}”(hŒCopyright 2004 Linus Torvalds”h]”hŒCopyright 2004 Linus Torvalds”…”�”}”hh·sbah}”(h]”h ]”h"]”h$]”h&]”Œ xml:space”Œpreserve”uh1hµhhh²hh³Œ>/var/lib/git/docbuild/linux/Documentation/dev-tools/sparse.rst”h´Kubh¶)�”}”(hŒ*Copyright 2004 Pavel Machek ”h]”hŒ*Copyright 2004 Pavel Machek ”…”�”}”hhÈsbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1hµhhh²hh³hÇh´Kubh¶)�”}”(hŒ0Copyright 2006 Bob Copeland ”h]”hŒ0Copyright 2006 Bob Copeland ”…”�”}”hhÖsbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1hµhhh²hh³hÇh´KubhŒsection”“”)�”}”(hhh]”(hŒtitle”“”)�”}”(hŒSparse”h]”hŒSparse”…”�”}”(hhëh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1héhhæh²hh³hÇh´KubhŒ paragraph”“”)�”}”(hXsSparse is a semantic checker for C programs; it can be used to find a number of potential problems with kernel code. See https://lwn.net/Articles/689907/ for an overview of sparse; this document contains some kernel-specific sparse information. More information on sparse, mainly about its internals, can be found in its official pages at https://sparse.docs.kernel.org.”h]”(hŒzSparse is a semantic checker for C programs; it can be used to find a number of potential problems with kernel code. See ”…”�”}”(hhûh²hh³Nh´NubhŒ reference”“”)�”}”(hŒ https://lwn.net/Articles/689907/”h]”hŒ https://lwn.net/Articles/689907/”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefuri”juh1jhhûubhŒº for an overview of sparse; this document contains some kernel-specific sparse information. More information on sparse, mainly about its internals, can be found in its official pages at ”…”�”}”(hhûh²hh³Nh´Nubj)�”}”(hŒhttps://sparse.docs.kernel.org”h]”hŒhttps://sparse.docs.kernel.org”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefuri”juh1jhhûubhŒ.”…”�”}”(hhûh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hùh³hÇh´Khhæh²hubhå)�”}”(hhh]”(hê)�”}”(hŒUsing sparse for typechecking”h]”hŒUsing sparse for typechecking”…”�”}”(hj4h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1héhj1h²hh³hÇh´Kubhú)�”}”(hŒH"__bitwise" is a type attribute, so you have to do something like this::”h]”hŒK“__bitwiseâ€� is a type attribute, so you have to do something like this:”…”�”}”(hjBh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hùh³hÇh´Khj1h²hubhŒ literal_block”“”)�”}”(hŒ•typedef int __bitwise pm_request_t; enum pm_request { PM_SUSPEND = (__force pm_request_t) 1, PM_RESUME = (__force pm_request_t) 2 };”h]”hŒ•typedef int __bitwise pm_request_t; enum pm_request { PM_SUSPEND = (__force pm_request_t) 1, PM_RESUME = (__force pm_request_t) 2 };”…”�”}”hjRsbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1jPh³hÇh´Khj1h²hubhú)�”}”(hX1which makes PM_SUSPEND and PM_RESUME "bitwise" integers (the "__force" is there because sparse will complain about casting to/from a bitwise type, but in this case we really _do_ want to force the conversion). And because the enum values are all the same type, now "enum pm_request" will be that type too.”h]”hX=which makes PM_SUSPEND and PM_RESUME “bitwiseâ€� integers (the “__forceâ€� is there because sparse will complain about casting to/from a bitwise type, but in this case we really _do_ want to force the conversion). And because the enum values are all the same type, now “enum pm_requestâ€� will be that type too.”…”�”}”(hj`h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hùh³hÇh´Khj1h²hubhú)�”}”(hŒrAnd with gcc, all the "__bitwise"/"__force stuff" goes away, and it all ends up looking just like integers to gcc.”h]”hŒzAnd with gcc, all the “__bitwiseâ€�/â€�__force stuffâ€� goes away, and it all ends up looking just like integers to gcc.”…”�”}”(hjnh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hùh³hÇh´K"hj1h²hubhú)�”}”(hŒwQuite frankly, you don't need the enum there. The above all really just boils down to one special "int __bitwise" type.”h]”hŒ}Quite frankly, you don’t need the enum there. The above all really just boils down to one special “int __bitwiseâ€� type.”…”�”}”(hj|h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hùh³hÇh´K%hj1h²hubhú)�”}”(hŒ"So the simpler way is to just do::”h]”hŒ!So the simpler way is to just do:”…”�”}”(hjŠh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hùh³hÇh´K(hj1h²hubjQ)�”}”(hŒtypedef int __bitwise pm_request_t; #define PM_SUSPEND ((__force pm_request_t) 1) #define PM_RESUME ((__force pm_request_t) 2)”h]”hŒtypedef int __bitwise pm_request_t; #define PM_SUSPEND ((__force pm_request_t) 1) #define PM_RESUME ((__force pm_request_t) 2)”…”�”}”hj˜sbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1jPh³hÇh´K*hj1h²hubhú)�”}”(hŒGand you now have all the infrastructure needed for strict typechecking.”h]”hŒGand you now have all the infrastructure needed for strict typechecking.”…”�”}”(hj¦h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hùh³hÇh´K/hj1h²hubhú)�”}”(hXgOne small note: the constant integer "0" is special. You can use a constant zero as a bitwise integer type without sparse ever complaining. This is because "bitwise" (as the name implies) was designed for making sure that bitwise types don't get mixed up (little-endian vs big-endian vs cpu-endian vs whatever), and there the constant "0" really _is_ special.”h]”hXuOne small note: the constant integer “0â€� is special. You can use a constant zero as a bitwise integer type without sparse ever complaining. This is because “bitwiseâ€� (as the name implies) was designed for making sure that bitwise types don’t get mixed up (little-endian vs big-endian vs cpu-endian vs whatever), and there the constant “0â€� really _is_ special.”…”�”}”(hj´h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hùh³hÇh´K1hj1h²hubeh}”(h]”Œusing-sparse-for-typechecking”ah ]”h"]”Œusing sparse for typechecking”ah$]”h&]”uh1hähhæh²hh³hÇh´Kubhå)�”}”(hhh]”(hê)�”}”(hŒGetting sparse”h]”hŒGetting sparse”…”�”}”(hjÍh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1héhjÊh²hh³hÇh´K9ubhú)�”}”(hŒqYou can get tarballs of the latest released versions from: https://www.kernel.org/pub/software/devel/sparse/dist/”h]”(hŒ;You can get tarballs of the latest released versions from: ”…”�”}”(hjÛh²hh³Nh´Nubj)�”}”(hŒ6https://www.kernel.org/pub/software/devel/sparse/dist/”h]”hŒ6https://www.kernel.org/pub/software/devel/sparse/dist/”…”�”}”(hjãh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefuri”jåuh1jhjÛubeh}”(h]”h ]”h"]”h$]”h&]”uh1hùh³hÇh´K;hjÊh²hubhú)�”}”(hŒeAlternatively, you can get snapshots of the latest development version of sparse using git to clone::”h]”hŒdAlternatively, you can get snapshots of the latest development version of sparse using git to clone:”…”�”}”(hjøh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hùh³hÇh´K>hjÊh²hubjQ)�”}”(hŒ4git://git.kernel.org/pub/scm/devel/sparse/sparse.git”h]”hŒ4git://git.kernel.org/pub/scm/devel/sparse/sparse.git”…”�”}”hjsbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1jPh³hÇh´KAhjÊh²hubhú)�”}”(hŒOnce you have it, just do::”h]”hŒOnce you have it, just do:”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hùh³hÇh´KChjÊh²hubjQ)�”}”(hŒmake make install”h]”hŒmake make install”…”�”}”hj"sbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1jPh³hÇh´KEhjÊh²hubhú)�”}”(hŒFas a regular user, and it will install sparse in your ~/bin directory.”h]”hŒFas a regular user, and it will install sparse in your ~/bin directory.”…”�”}”(hj0h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hùh³hÇh´KHhjÊh²hubeh}”(h]”Œgetting-sparse”ah ]”h"]”Œgetting sparse”ah$]”h&]”uh1hähhæh²hh³hÇh´K9ubhå)�”}”(hhh]”(hê)�”}”(hŒ Using sparse”h]”hŒ Using sparse”…”�”}”(hjIh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1héhjFh²hh³hÇh´KKubhú)�”}”(hŒþDo a kernel make with "make C=1" to run sparse on all the C files that get recompiled, or use "make C=2" to run sparse on the files whether they need to be recompiled or not. The latter is a fast way to check the whole tree if you have already built it.”h]”hXDo a kernel make with “make C=1â€� to run sparse on all the C files that get recompiled, or use “make C=2â€� to run sparse on the files whether they need to be recompiled or not. The latter is a fast way to check the whole tree if you have already built it.”…”�”}”(hjWh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hùh³hÇh´KMhjFh²hubhú)�”}”(hŒ‚The optional make variable CF can be used to pass arguments to sparse. The build system passes -Wbitwise to sparse automatically.”h]”hŒ‚The optional make variable CF can be used to pass arguments to sparse. The build system passes -Wbitwise to sparse automatically.”…”�”}”(hjeh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hùh³hÇh´KRhjFh²hubhú)�”}”(hŒ=Note that sparse defines the __CHECKER__ preprocessor symbol.”h]”hŒ=Note that sparse defines the __CHECKER__ preprocessor symbol.”…”�”}”(hjsh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hùh³hÇh´KUhjFh²hubeh}”(h]”Œ using-sparse”ah ]”h"]”Œ using sparse”ah$]”h&]”uh1hähhæh²hh³hÇh´KKubeh}”(h]”Œsparse”ah ]”h"]”Œsparse”ah$]”h&]”uh1hähhh²hh³hÇh´Kubeh}”(h]”h ]”h"]”h$]”h&]”Œsource”hÇuh1hŒcurrent_source”NŒ current_line”NŒsettings”Œdocutils.frontend”ŒValues”“”)�”}”(héNŒ generator”NŒ datestamp”NŒ source_link”NŒ source_url”NŒ toc_backlinks”Œentry”Œfootnote_backlinks”KŒ sectnum_xform”KŒstrip_comments”NŒstrip_elements_with_classes”NŒ strip_classes”NŒ report_level”KŒ halt_level”KŒexit_status_level”KŒdebug”NŒwarning_stream”NŒ traceback”ˆŒinput_encoding”Œ utf-8-sig”Œinput_encoding_error_handler”Œstrict”Œoutput_encoding”Œutf-8”Œoutput_encoding_error_handler”j´Œerror_encoding”Œutf-8”Œerror_encoding_error_handler”Œbackslashreplace”Œ language_code”Œen”Œrecord_dependencies”NŒconfig”NŒ id_prefix”hŒauto_id_prefix”Œid”Œ dump_settings”NŒdump_internals”NŒdump_transforms”NŒdump_pseudo_xml”NŒexpose_internals”NŒstrict_visitor”NŒ_disable_config”NŒ_source”hÇŒ _destination”NŒ _config_files”]”Œ7/var/lib/git/docbuild/linux/Documentation/docutils.conf”aŒfile_insertion_enabled”ˆŒ raw_enabled”KŒline_length_limit”M'Œpep_references”NŒ pep_base_url”Œhttps://peps.python.org/”Œpep_file_url_template”Œpep-%04d”Œrfc_references”NŒ rfc_base_url”Œ&https://datatracker.ietf.org/doc/html/”Œ tab_width”KŒtrim_footnote_reference_space”‰Œsyntax_highlight”Œlong”Œ smart_quotes”ˆŒsmartquotes_locales”]”Œcharacter_level_inline_markup”‰Œdoctitle_xform”‰Œ docinfo_xform”KŒsectsubtitle_xform”‰Œ image_loading”Œlink”Œembed_stylesheet”‰Œcloak_email_addresses”ˆŒsection_self_link”‰Œenv”NubŒreporter”NŒindirect_targets”]”Œsubstitution_defs”}”Œsubstitution_names”}”Œrefnames”}”Œrefids”}”Œnameids”}”(jŽj‹jÇjÄjCj@j†jƒuŒ nametypes”}”(jމjljjC‰j†‰uh}”(j‹hæjÄj1j@jÊjƒjFuŒ footnote_refs”}”Œ citation_refs”}”Œ autofootnotes”]”Œautofootnote_refs”]”Œsymbol_footnotes”]”Œsymbol_footnote_refs”]”Œ footnotes”]”Œ citations”]”Œautofootnote_start”KŒsymbol_footnote_start”KŒ id_counter”Œ collections”ŒCounter”“”}”…”R”Œparse_messages”]”Œtransform_messages”]”Œ transformer”NŒ include_log”]”Œ decoration”Nh²hub.