# Hide warnings in typed PPX

**URL:** <https://discuss.ocaml.org/t/hide-warnings-in-typed-ppx/13905>\
**Category:** Learning\
**Tags:** ppx\
**Created:** [January 20, 2024, 2:56pm UTC](https://discuss.ocaml.org/t/hide-warnings-in-typed-ppx/13905 "2024-01-20T14:56:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![masaki110](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/masaki110/32/3732_2.png) [@masaki110](https://discuss.ocaml.org/u/masaki110)\
**Post date:** [January 20, 2024, 2:56pm UTC](https://discuss.ocaml.org/t/hide-warnings-in-typed-ppx/13905/1 "2024-01-20T14:56:40Z")

</div>

Hello, sorry for my bad English.

Can I hide the warning 20 when type checking with `Typemod.copy_structure` in PPX?

I am creating a PPX rewriter that adds `Obj.magic()`, type checks by `Typemod.copy_structure` and processes, and finally removes `Obj.magic()` and outputs. I understand the usefulness of warning 20, but find the intermediate file warnings annoying.

---

<div class="post-metadata">

**Author:** ![nojb](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/nojb/32/519_2.png) [@nojb](https://discuss.ocaml.org/u/nojb)\
**Post date:** [January 20, 2024, 3:29pm UTC](https://discuss.ocaml.org/t/hide-warnings-in-typed-ppx/13905/2 "2024-01-20T15:29:06Z")

</div>

If you are typechecking generated code, you could also emit

```auto
[@@@warning "-20"]

```

at the top of your generated code. Alternatively, you could use `Warnings.without_warning` (this disables all warning), or `Warnings.parse_options false "-20"` to disable just that options. (The module `Warnings` is part of `compiler-libs`.)

Cheers,  
Nicolas
