Migrate from CIL's Pretty to OCaml's Format (initial pass)#1994
Draft
Migrate from CIL's Pretty to OCaml's Format (initial pass)#1994
Pretty to OCaml's Format (initial pass)#1994Conversation
6 tasks
Member
|
There's little use to this without doing this in CIL first. There are old branches in both that go 95% of the way (at the time). The reason they didn't get done is that there are tricky things that |
Add pp to modules that implement Printable.S without SimplePretty/SimpleShow/SimpleFormat: - FlagHelper: derive pp from show - partitionDomain: Make and SetSet get pp from show - ResultType2: derive pp from overridden show - creationLockset A: derive pp from show - mCPRegistry DomListPrintable/DomVariantPrintable: derive pp from show - basetype Variables/RawStrings/CilStmt: derive pp from show - controlSpecC: derive pp from show Add pp_trace to VarType signature and implementations: - constrSys VarType: add val pp_trace - constrSys Var2: implement pp_trace via GobPretty.sprint - analyses VarF: implement pp_trace via GobPretty.sprint - analyses GVarF/GVarFC: pp_trace = pp - node: add pp_trace using show Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: michael-schwarz <13812333+michael-schwarz@users.noreply.github.com>
Agent-Logs-Url: https://github.com/goblint/analyzer/sessions/fc978a58-7acb-4657-923a-8cd4ecb79445 Co-authored-by: michael-schwarz <13812333+michael-schwarz@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Migrate from CIL's Pretty to OCaml's Format
Migrate from CIL's Apr 12, 2026
Pretty to OCaml's Format (initial pass)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Begins the migration from CIL's unmaintained
Prettymodule to OCaml's standardFormatmodule, which is faster (no intermediatedocconstruction, GADT-based internals), maintained, and compatible withppx_deriving.show.Core interface change
Added
val pp: Format.formatter -> t -> unittoPrintable.S— the de facto standard signature, also derived byppx_deriving.show:Changes
Printable.S— addsval pp: Format.formatter -> t -> unitprintable.mlfunctors — all functors (SimplePretty,SimpleShow,SimpleFormat,UnitConf,HConsed,HashCached,LiftConf,Lift2Conf,ProdConf,Prod3,Liszt,Chain,LiftBot,LiftTop,Option) now derive/providepp, so modules using them get it for freepptosetDomain,mapDomain,hoareDomain,baseDomain,musteqDomain,threadIdDomain,intDomTuple,valueDomain,arrayDomain,structDomain, all apron domains, and utility modules (gobFpath,gobYojson,edge)VarTypesignature — addedpp_trace: Format.formatter -> t -> unitwith implementations inconstrSys.ml,analyses.ml,node.mlgoblint_tracing.ml,messages.ml) — rewritesgtrace/tracel/tracelito useFormat.kfprintf/Format.ifprintfinstead ofPretty.gprintf/GobPretty.igprintf; trace output is now written via aBuffer+formatter, then flushed as a string withPrintf.eprintfD.ppinstead ofD.pretty,pp_traceinstead ofpretty_trace, andCilType.Exp.pp/CilType.Typ.pp/CilType.Lval.ppin place of CIL'sd_exp/d_type/d_lvalKnown remaining issues
A handful of call sites in
td3.mlstill usePretty.docOpt (S.Var.pp_trace ())andS.Dom.pretty_diffinside trace calls — these need Format-compatible replacements (GobFormat.pp_print_optand a Format-based diff printer).Messages.warn/info/debug/errorstill usePretty-based format strings and are out of scope for this initial pass.