Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

default_headers custom order #8

Open
ozanmakes opened this issue Nov 18, 2022 · 2 comments
Open

default_headers custom order #8

ozanmakes opened this issue Nov 18, 2022 · 2 comments

Comments

@ozanmakes
Copy link

Because of inclusion of default_headers before my own headers I'm getting a lot of compiler warnings. For example, I have gstreamer bindings and the gst_stubs.c ends up like this:

#include <caml/callback.h>
#include <caml/fail.h>
...
#include <ges/ges.h>
#include <gst/gst.h>

As a result of that I get many pages of warnings like so:

In file included from /usr/local/include/gstreamer-1.0/ges/ges.h:50:
In file included from /usr/local/include/gstreamer-1.0/ges/ges-asset.h:25:
In file included from /usr/local/include/gstreamer-1.0/ges/ges-extractable.h:26:
In file included from /opt/homebrew/Cellar/glib/2.74.0/include/glib-2.0/gio/gio.h:177:
/opt/homebrew/Cellar/glib/2.74.0/include/glib-2.0/gio/gvolume.h:243:69: warning: "callback" is deprecated: use "caml_callback" instead [-W#pragma-messages]
                                               GAsyncReadyCallback  callback,
                                                                    ^
/Users/osener/.opam/4.14.0/lib/ocaml/caml/compatibility.h:71:18: note: expanded from macro 'callback'
#define callback CAML_DEPRECATED("callback", "caml_callback") caml_callback
                 ^
/Users/osener/.opam/4.14.0/lib/ocaml/caml/misc.h:57:3: note: expanded from macro 'CAML_DEPRECATED'
  CAML_PREPROWARNING(name1 is deprecated: use name2 instead)
  ^
/Users/osener/.opam/4.14.0/lib/ocaml/caml/misc.h:55:31: note: expanded from macro 'CAML_PREPROWARNING'
#define CAML_PREPROWARNING(x) _Pragma(CAML_MAKEWARNING2(x))
                              ^
<scratch space>:89:6: note: expanded from here
 GCC warning "\"callback\" is deprecated: use \"caml_callback\" instead"
     ^
In file included from gst_stubs.c:53:
In file included from /usr/local/include/gstreamer-1.0/ges/ges.h:50:
/usr/local/include/gstreamer-1.0/ges/ges-asset.h:112:59: warning: "callback" is deprecated: use "caml_callback" instead [-W#pragma-messages]
                                      GAsyncReadyCallback callback,
                                                          ^
/Users/osener/.opam/4.14.0/lib/ocaml/caml/compatibility.h:71:18: note: expanded from macro 'callback'
#define callback CAML_DEPRECATED("callback", "caml_callback") caml_callback
                 ^
/Users/osener/.opam/4.14.0/lib/ocaml/caml/misc.h:57:3: note: expanded from macro 'CAML_DEPRECATED'
  CAML_PREPROWARNING(name1 is deprecated: use name2 instead)
  ^
/Users/osener/.opam/4.14.0/lib/ocaml/caml/misc.h:55:31: note: expanded from macro 'CAML_PREPROWARNING'
#define CAML_PREPROWARNING(x) _Pragma(CAML_MAKEWARNING2(x))
                              ^
<scratch space>:159:6: note: expanded from here
 GCC warning "\"callback\" is deprecated: use \"caml_callback\" instead"
     ^
In file included from gst_stubs.c:53:
In file included from /usr/local/include/gstreamer-1.0/ges/ges.h:53:
/usr/local/include/gstreamer-1.0/ges/ges-uri-asset.h:73:74: warning: "callback" is deprecated: use "caml_callback" instead [-W#pragma-messages]
                                                     GAsyncReadyCallback callback,
                                                                         ^
/Users/osener/.opam/4.14.0/lib/ocaml/caml/compatibility.h:71:18: note: expanded from macro 'callback'
#define callback CAML_DEPRECATED("callback", "caml_callback") caml_callback
                 ^
/Users/osener/.opam/4.14.0/lib/ocaml/caml/misc.h:57:3: note: expanded from macro 'CAML_DEPRECATED'
  CAML_PREPROWARNING(name1 is deprecated: use name2 instead)
  ^
/Users/osener/.opam/4.14.0/lib/ocaml/caml/misc.h:55:31: note: expanded from macro 'CAML_PREPROWARNING'
#define CAML_PREPROWARNING(x) _Pragma(CAML_MAKEWARNING2(x))
                              ^
<scratch space>:70:6: note: expanded from here
 GCC warning "\"callback\" is deprecated: use \"caml_callback\" instead"
     ^
244 warnings generated.

Is there a way to customise this or work around it?

@fdopen
Copy link
Owner

fdopen commented Nov 18, 2022

Do the warning messages already disappear when CAML_NAME_SPACE is properly defined?
#caml-name-space

If there really is a name collision between the headers of OCaml and the manually added headers, it gets ugly. There would be more to consider and spontaneously I am unsure how to solve this in a way that is not error prone and transparent.

@ozanmakes
Copy link
Author

I really appreciate your quick response! I wanted to try this branch first thing this week but it slipped my mind.

CAML_NAME_SPACE does the trick for my codebase. No warnings get reported anymore, and it makes it much easier to develop because warnings and errors from my own code don't get lost in all this. This is great, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants