Mute "Alert deprecated: ISO-Latin1 characters in identifiers"

How do I mute “Alert deprecated: ISO-Latin1 characters in identifiers” error?
I’m using a batch script to compare OCaml codes using Compiler_libs, and I get this error printed from some (poor) codes.
But I don’t want these warning messages to be put into the log file.

Is there a way to mute these, perhaps using an environment variable?
Or can I “catch” or turn this off in my program?

Thanks!

1 Like

You can disable all “deprecated” alerts with the command line option -alert -deprecated to the compiler.

You can also use [@alert "-deprecated"] as an attribute in code to only disable this alert for part of your code. The section on attributes in the manual details how to scope these. This would be appropriate if you wanted other deprecated-type alerts to be logged but you can identify where just the one you want to ignore can happen.

1 Like

Thank you for the suggestion!

However, I tried putting the "-alert" ... in the dune file as well as trying to put an attribute in my code, but it doesn’t seem to work.
I tried, for instance,

  let[@alert "-deprecated"] ast = Parse.implementation lexbuf in

"
To clarify, the alert is not coming from building my code, but coming from my built binary that reads other OCaml programs.
Perhaps the warnings are coming from internal functions from compiler-libs.common?

You’ll need to use Warnings.parse_options

1 Like

Thanks for the pointer! I ended up wrapping my driver function with Warnings.without_warnings, and it worked like a charm.