Add a simple way to do not even provide prototypes of deprecated
functions in the C library: this way, users (like our tools) can build
against the library making sure to not use any deprecated function, not
even when compiler deprecation warnings are disabled.
Add it to the majority of our tools/internal libraries, and make sure
that it is not defined when building the API bridges of our bindings.
---
align/Makefile.am | 1 +
cat/Makefile.am | 5 +++++
common/edit/Makefile.am | 1 +
common/options/Makefile.am | 1 +
common/parallel/Makefile.am | 1 +
common/progress/Makefile.am | 1 +
common/structs/Makefile.am | 1 +
common/utils/Makefile.am | 1 +
common/visit/Makefile.am | 1 +
common/windows/Makefile.am | 1 +
df/Makefile.am | 1 +
diff/Makefile.am | 1 +
edit/Makefile.am | 1 +
examples/Makefile.am | 8 ++++++++
fish/Makefile.am | 1 +
format/Makefile.am | 1 +
fuse/Makefile.am | 2 ++
generator/GObject.ml | 1 +
generator/OCaml.ml | 1 +
generator/c.ml | 14 ++++++++++++++
generator/erlang.ml | 1 +
generator/fish.ml | 1 +
generator/golang.ml | 2 +-
generator/java.ml | 1 +
generator/lua.ml | 1 +
generator/perl.ml | 1 +
generator/php.ml | 1 +
generator/python.ml | 1 +
generator/ruby.ml | 1 +
generator/tests_c_api.ml | 1 +
inspector/Makefile.am | 1 +
make-fs/Makefile.am | 1 +
rescue/Makefile.am | 1 +
test-tool/Makefile.am | 1 +
tests/mount-local/Makefile.am | 1 +
tests/mountable/Makefile.am | 1 +
tests/parallel/Makefile.am | 1 +
37 files changed, 62 insertions(+), 1 deletion(-)
diff --git a/align/Makefile.am b/align/Makefile.am
index 6c6fdc455..1c698561b 100644
--- a/align/Makefile.am
+++ b/align/Makefile.am
@@ -29,6 +29,7 @@ virt_alignment_scan_SOURCES = \
scan.c
virt_alignment_scan_CPPFLAGS = \
+ -DGUESTFS_NO_DEPRECATED=1 \
-I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \
-I$(top_srcdir)/common/structs -I$(top_builddir)/common/structs \
-I$(top_srcdir)/lib -I$(top_builddir)/lib \
diff --git a/cat/Makefile.am b/cat/Makefile.am
index b4da82bbe..8e731d5b3 100644
--- a/cat/Makefile.am
+++ b/cat/Makefile.am
@@ -36,6 +36,7 @@ virt_cat_SOURCES = \
cat.c
virt_cat_CPPFLAGS = \
+ -DGUESTFS_NO_DEPRECATED=1 \
-DLOCALEBASEDIR=\""$(datadir)/locale"\" \
-I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \
-I$(top_srcdir)/common/structs -I$(top_builddir)/common/structs \
@@ -63,6 +64,7 @@ virt_filesystems_SOURCES = \
filesystems.c
virt_filesystems_CPPFLAGS = \
+ -DGUESTFS_NO_DEPRECATED=1 \
-DLOCALEBASEDIR=\""$(datadir)/locale"\" \
-I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \
-I$(top_srcdir)/common/structs -I$(top_builddir)/common/structs \
@@ -90,6 +92,7 @@ virt_log_SOURCES = \
log.c
virt_log_CPPFLAGS = \
+ -DGUESTFS_NO_DEPRECATED=1 \
-DLOCALEBASEDIR=\""$(datadir)/locale"\" \
-I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \
-I$(top_srcdir)/common/structs -I$(top_builddir)/common/structs \
@@ -116,6 +119,7 @@ virt_ls_SOURCES = \
ls.c
virt_ls_CPPFLAGS = \
+ -DGUESTFS_NO_DEPRECATED=1 \
-DLOCALEBASEDIR=\""$(datadir)/locale"\" \
-I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \
-I$(top_srcdir)/common/structs -I$(top_builddir)/common/structs \
@@ -144,6 +148,7 @@ virt_tail_SOURCES = \
tail.c
virt_tail_CPPFLAGS = \
+ -DGUESTFS_NO_DEPRECATED=1 \
-DLOCALEBASEDIR=\""$(datadir)/locale"\" \
-I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \
-I$(top_srcdir)/common/structs -I$(top_builddir)/common/structs \
diff --git a/common/edit/Makefile.am b/common/edit/Makefile.am
index 8371a6aac..45ef9b2d6 100644
--- a/common/edit/Makefile.am
+++ b/common/edit/Makefile.am
@@ -25,6 +25,7 @@ libedit_la_SOURCES = \
file-edit.c \
file-edit.h
libedit_la_CPPFLAGS = \
+ -DGUESTFS_NO_DEPRECATED=1 \
-I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \
-I$(top_srcdir)/lib -I$(top_builddir)/lib
libedit_la_CFLAGS = \
diff --git a/common/options/Makefile.am b/common/options/Makefile.am
index 23a13d928..9b4554dc5 100644
--- a/common/options/Makefile.am
+++ b/common/options/Makefile.am
@@ -34,6 +34,7 @@ liboptions_la_SOURCES = \
uri.h \
uri.c
liboptions_la_CPPFLAGS = \
+ -DGUESTFS_NO_DEPRECATED=1 \
-I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \
-I$(top_srcdir)/lib -I$(top_builddir)/lib \
-I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib
diff --git a/common/parallel/Makefile.am b/common/parallel/Makefile.am
index 5254e1723..bb727e35d 100644
--- a/common/parallel/Makefile.am
+++ b/common/parallel/Makefile.am
@@ -30,6 +30,7 @@ libparallel_la_SOURCES = \
parallel.c \
parallel.h
libparallel_la_CPPFLAGS = \
+ -DGUESTFS_NO_DEPRECATED=1 \
-I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \
-I$(top_srcdir)/lib -I$(top_builddir)/lib \
-I$(top_srcdir)/common/options -I$(top_builddir)/common/options \
diff --git a/common/progress/Makefile.am b/common/progress/Makefile.am
index acb210327..6361b413a 100644
--- a/common/progress/Makefile.am
+++ b/common/progress/Makefile.am
@@ -25,6 +25,7 @@ libprogress_la_SOURCES = \
progress.c \
progress.h
libprogress_la_CPPFLAGS = \
+ -DGUESTFS_NO_DEPRECATED=1 \
-I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \
-I$(top_srcdir)/lib -I$(top_builddir)/lib
libprogress_la_CFLAGS = \
diff --git a/common/structs/Makefile.am b/common/structs/Makefile.am
index 228bcb0f3..08fd5c57e 100644
--- a/common/structs/Makefile.am
+++ b/common/structs/Makefile.am
@@ -35,6 +35,7 @@ libstructs_la_SOURCES = \
../../lib/guestfs.h \
$(BUILT_SOURCES)
libstructs_la_CPPFLAGS = \
+ -DGUESTFS_NO_DEPRECATED=1 \
-DGUESTFS_PRIVATE=1 \
-I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \
-I$(top_srcdir)/lib -I$(top_builddir)/lib
diff --git a/common/utils/Makefile.am b/common/utils/Makefile.am
index 1849dbb27..2cd33e506 100644
--- a/common/utils/Makefile.am
+++ b/common/utils/Makefile.am
@@ -29,6 +29,7 @@ libutils_la_SOURCES = \
libxml2-writer-macros.h \
utils.c
libutils_la_CPPFLAGS = \
+ -DGUESTFS_NO_DEPRECATED=1 \
-DGUESTFS_PRIVATE=1 \
-I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \
-I$(top_srcdir)/lib -I$(top_builddir)/lib
diff --git a/common/visit/Makefile.am b/common/visit/Makefile.am
index 62fee334c..f45d4fd5e 100644
--- a/common/visit/Makefile.am
+++ b/common/visit/Makefile.am
@@ -23,6 +23,7 @@ libvisit_la_SOURCES = \
visit.c \
visit.h
libvisit_la_CPPFLAGS = \
+ -DGUESTFS_NO_DEPRECATED=1 \
-DGUESTFS_PRIVATE=1 \
-I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \
-I$(top_srcdir)/lib -I$(top_builddir)/lib \
diff --git a/common/windows/Makefile.am b/common/windows/Makefile.am
index 14f9ec7f4..49e13b616 100644
--- a/common/windows/Makefile.am
+++ b/common/windows/Makefile.am
@@ -25,6 +25,7 @@ libwindows_la_SOURCES = \
windows.c \
windows.h
libwindows_la_CPPFLAGS = \
+ -DGUESTFS_NO_DEPRECATED=1 \
-I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \
-I$(top_srcdir)/lib -I$(top_builddir)/lib \
-I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib
diff --git a/df/Makefile.am b/df/Makefile.am
index bba54500e..92493f123 100644
--- a/df/Makefile.am
+++ b/df/Makefile.am
@@ -33,6 +33,7 @@ virt_df_SOURCES = \
output.c
virt_df_CPPFLAGS = \
+ -DGUESTFS_NO_DEPRECATED=1 \
-DLOCALEBASEDIR=\""$(datadir)/locale"\" \
-I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \
-I$(top_srcdir)/common/structs -I$(top_builddir)/common/structs \
diff --git a/diff/Makefile.am b/diff/Makefile.am
index 8db8aca72..9452c6de2 100644
--- a/diff/Makefile.am
+++ b/diff/Makefile.am
@@ -28,6 +28,7 @@ virt_diff_SOURCES = \
diff.c
virt_diff_CPPFLAGS = \
+ -DGUESTFS_NO_DEPRECATED=1 \
-DLOCALEBASEDIR=\""$(datadir)/locale"\" \
-I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \
-I$(top_srcdir)/lib -I$(top_builddir)/lib \
diff --git a/edit/Makefile.am b/edit/Makefile.am
index fd9887949..5c90a93df 100644
--- a/edit/Makefile.am
+++ b/edit/Makefile.am
@@ -28,6 +28,7 @@ virt_edit_SOURCES = \
edit.c
virt_edit_CPPFLAGS = \
+ -DGUESTFS_NO_DEPRECATED=1 \
-DLOCALEBASEDIR=\""$(datadir)/locale"\" \
-I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \
-I$(top_srcdir)/lib -I$(top_builddir)/lib \
diff --git a/examples/Makefile.am b/examples/Makefile.am
index 81a8cc0b7..334da40f0 100644
--- a/examples/Makefile.am
+++ b/examples/Makefile.am
@@ -43,6 +43,7 @@ endif
if HAVE_LIBVIRT
copy_over_SOURCES = copy-over.c
copy_over_CPPFLAGS = \
+ -DGUESTFS_NO_DEPRECATED=1 \
-I$(top_srcdir)/lib -I$(top_builddir)/lib
copy_over_CFLAGS = \
$(LIBVIRT_CFLAGS) \
@@ -54,6 +55,7 @@ copy_over_LDADD = \
libvirt_auth_SOURCES = libvirt-auth.c
libvirt_auth_CPPFLAGS = \
+ -DGUESTFS_NO_DEPRECATED=1 \
-I$(top_srcdir)/lib -I$(top_builddir)/lib
libvirt_auth_CFLAGS = \
$(LIBVIRT_CFLAGS) \
@@ -66,6 +68,7 @@ endif
create_disk_SOURCES = create-disk.c
create_disk_CPPFLAGS = \
+ -DGUESTFS_NO_DEPRECATED=1 \
-I$(top_srcdir)/lib -I$(top_builddir)/lib
create_disk_CFLAGS = \
$(WARN_CFLAGS) $(WERROR_CFLAGS)
@@ -74,6 +77,7 @@ create_disk_LDADD = \
debug_logging_SOURCES = debug-logging.c
debug_logging_CPPFLAGS = \
+ -DGUESTFS_NO_DEPRECATED=1 \
-I$(top_srcdir)/lib -I$(top_builddir)/lib
debug_logging_CFLAGS = \
$(WARN_CFLAGS) $(WERROR_CFLAGS)
@@ -82,6 +86,7 @@ debug_logging_LDADD = \
display_icon_SOURCES = display-icon.c
display_icon_CPPFLAGS = \
+ -DGUESTFS_NO_DEPRECATED=1 \
-I$(top_srcdir)/lib -I$(top_builddir)/lib
display_icon_CFLAGS = \
$(WARN_CFLAGS) $(WERROR_CFLAGS)
@@ -90,6 +95,7 @@ display_icon_LDADD = \
inspect_vm_SOURCES = inspect-vm.c
inspect_vm_CPPFLAGS = \
+ -DGUESTFS_NO_DEPRECATED=1 \
-I$(top_srcdir)/lib -I$(top_builddir)/lib
inspect_vm_CFLAGS = \
$(WARN_CFLAGS) $(WERROR_CFLAGS)
@@ -99,6 +105,7 @@ inspect_vm_LDADD = \
if HAVE_FUSE
mount_local_SOURCES = mount-local.c
mount_local_CPPFLAGS = \
+ -DGUESTFS_NO_DEPRECATED=1 \
-I$(top_srcdir)/lib -I$(top_builddir)/lib
mount_local_CFLAGS = \
-I$(top_srcdir)/lib -I$(top_builddir)/lib \
@@ -112,6 +119,7 @@ endif
if HAVE_HIVEX
virt_dhcp_address_SOURCES = virt-dhcp-address.c
virt_dhcp_address_CPPFLAGS = \
+ -DGUESTFS_NO_DEPRECATED=1 \
-I$(top_srcdir)/lib -I$(top_builddir)/lib
virt_dhcp_address_CFLAGS = \
$(WARN_CFLAGS) $(WERROR_CFLAGS)
diff --git a/fish/Makefile.am b/fish/Makefile.am
index 001cd0ddf..0e01ed9fd 100644
--- a/fish/Makefile.am
+++ b/fish/Makefile.am
@@ -123,6 +123,7 @@ cmds-gperf.c: cmds-gperf.gperf
mv $@-t $@
guestfish_CPPFLAGS = \
+ -DGUESTFS_NO_DEPRECATED=1 \
-DLOCALEBASEDIR=\""$(datadir)/locale"\" \
-I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \
-I$(top_srcdir)/common/structs -I$(top_builddir)/common/structs \
diff --git a/format/Makefile.am b/format/Makefile.am
index 71876fd90..125c57184 100644
--- a/format/Makefile.am
+++ b/format/Makefile.am
@@ -28,6 +28,7 @@ virt_format_SOURCES = \
format.c
virt_format_CPPFLAGS = \
+ -DGUESTFS_NO_DEPRECATED=1 \
-DLOCALEBASEDIR=\""$(datadir)/locale"\" \
-I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \
-I$(top_srcdir)/lib -I$(top_builddir)/lib \
diff --git a/fuse/Makefile.am b/fuse/Makefile.am
index 408f77a6a..e3b4a1cb5 100644
--- a/fuse/Makefile.am
+++ b/fuse/Makefile.am
@@ -36,6 +36,7 @@ guestmount_SOURCES = \
guestmount.c
guestmount_CPPFLAGS = \
+ -DGUESTFS_NO_DEPRECATED=1 \
-DLOCALEBASEDIR=\""$(datadir)/locale"\" \
-I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \
-I$(top_srcdir)/lib -I$(top_builddir)/lib \
@@ -65,6 +66,7 @@ guestunmount_SOURCES = \
guestunmount.c
guestunmount_CPPFLAGS = \
+ -DGUESTFS_NO_DEPRECATED=1 \
-DLOCALEBASEDIR=\""$(datadir)/locale"\" \
-I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \
-I$(top_srcdir)/lib -I$(top_builddir)/lib \
diff --git a/generator/GObject.ml b/generator/GObject.ml
index 0c8cd232b..4e695a5db 100644
--- a/generator/GObject.ml
+++ b/generator/GObject.ml
@@ -695,6 +695,7 @@ let generate_gobject_session_source () =
pr "
/* It is safe to call deprecated functions from this file. */
#define GUESTFS_NO_WARN_DEPRECATED
+#undef GUESTFS_NO_DEPRECATED
#include <glib.h>
#include <glib-object.h>
diff --git a/generator/OCaml.ml b/generator/OCaml.ml
index ad6679629..92a913015 100644
--- a/generator/OCaml.ml
+++ b/generator/OCaml.ml
@@ -414,6 +414,7 @@ and generate_ocaml_c () =
/* It is safe to call deprecated functions from this file. */
#define GUESTFS_NO_WARN_DEPRECATED
+#undef GUESTFS_NO_DEPRECATED
#include <stdio.h>
#include <stdlib.h>
diff --git a/generator/c.ml b/generator/c.ml
index 9d66f5299..d19573a03 100644
--- a/generator/c.ml
+++ b/generator/c.ml
@@ -559,6 +559,7 @@ typedef void (*guestfs_close_cb) (guestfs_h *g, void *opaque);
typedef void (*guestfs_progress_cb) (guestfs_h *g, void *opaque, int proc_nr, int serial,
uint64_t position, uint64_t total);
#endif
+#ifndef GUESTFS_NO_DEPRECATED
extern GUESTFS_DLL_PUBLIC void guestfs_set_log_message_callback (guestfs_h *g,
guestfs_log_message_cb cb, void *opaque)
GUESTFS_DEPRECATED_REPLACED_BY(\"set_event_callback\");
extern GUESTFS_DLL_PUBLIC void guestfs_set_subprocess_quit_callback (guestfs_h *g,
guestfs_subprocess_quit_cb cb, void *opaque)
@@ -571,6 +572,7 @@ extern GUESTFS_DLL_PUBLIC void guestfs_set_close_callback (guestfs_h
*g, guestfs
#define GUESTFS_HAVE_SET_PROGRESS_CALLBACK 1
extern GUESTFS_DLL_PUBLIC void guestfs_set_progress_callback (guestfs_h *g,
guestfs_progress_cb cb, void *opaque)
GUESTFS_DEPRECATED_REPLACED_BY(\"set_event_callback\");
+#endif /* !GUESTFS_NO_DEPRECATED */
/* Private data area. */
#define GUESTFS_HAVE_SET_PRIVATE 1
@@ -657,6 +659,13 @@ extern GUESTFS_DLL_PUBLIC void *guestfs_next_private (guestfs_h *g,
const char *
) optargs;
);
+ let deprecated =
+ match deprecated_by with
+ | Not_deprecated -> false
+ | Replaced_by _ | Deprecated_no_replacement -> true in
+
+ if deprecated then
+ pr "#ifndef GUESTFS_NO_DEPRECATED\n";
generate_prototype ~single_line:true ~semicolon:false ~dll_public:true
~handle:"g" ~prefix:"guestfs_" shortname style;
(match deprecated_by with
@@ -667,6 +676,8 @@ extern GUESTFS_DLL_PUBLIC void *guestfs_next_private (guestfs_h *g,
const char *
| Deprecated_no_replacement ->
pr "\n GUESTFS_DEPRECATED_NO_REPLACEMENT;\n"
);
+ if deprecated then
+ pr "#endif /* !GUESTFS_NO_DEPRECATED */\n";
if optargs <> [] then (
generate_prototype ~single_line:true ~newline:true ~handle:"g"
@@ -1332,6 +1343,9 @@ and generate_client_actions actions () =
pr "\
#include <config.h>
+/* It is safe to call deprecated functions from this file. */
+#undef GUESTFS_NO_DEPRECATED
+
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
diff --git a/generator/erlang.ml b/generator/erlang.ml
index 11d1f1920..0cee9c3ef 100644
--- a/generator/erlang.ml
+++ b/generator/erlang.ml
@@ -333,6 +333,7 @@ and generate_erlang_actions actions () =
/* It is safe to call deprecated functions from this file. */
#define GUESTFS_NO_WARN_DEPRECATED
+#undef GUESTFS_NO_DEPRECATED
#include <stdio.h>
#include <stdlib.h>
diff --git a/generator/fish.ml b/generator/fish.ml
index d165e2fb0..56489fa44 100644
--- a/generator/fish.ml
+++ b/generator/fish.ml
@@ -86,6 +86,7 @@ let generate_fish_run_cmds actions () =
pr "\n";
pr "/* It is safe to call deprecated functions from this file. */\n";
pr "#define GUESTFS_NO_WARN_DEPRECATED\n";
+ pr "#undef GUESTFS_NO_DEPRECATED\n";
pr "\n";
pr "#include <stdio.h>\n";
pr "#include <stdlib.h>\n";
diff --git a/generator/golang.ml b/generator/golang.ml
index 582b6f808..bd09ae9cf 100644
--- a/generator/golang.ml
+++ b/generator/golang.ml
@@ -40,7 +40,7 @@ let generate_golang_go () =
package guestfs
/*
-#cgo CFLAGS: -DGUESTFS_PRIVATE=1 -DGUESTFS_NO_WARN_DEPRECATED
+#cgo CFLAGS: -DGUESTFS_PRIVATE=1 -DGUESTFS_NO_WARN_DEPRECATED -UGUESTFS_NO_DEPRECATED
#cgo LDFLAGS: -lguestfs
#include <stdio.h>
#include <stdlib.h>
diff --git a/generator/java.ml b/generator/java.ml
index 6849f8a2d..bd92ae0a2 100644
--- a/generator/java.ml
+++ b/generator/java.ml
@@ -580,6 +580,7 @@ and generate_java_c actions () =
/* It is safe to call deprecated functions from this file. */
#define GUESTFS_NO_WARN_DEPRECATED
+#undef GUESTFS_NO_DEPRECATED
#include <stdio.h>
#include <stdlib.h>
diff --git a/generator/lua.ml b/generator/lua.ml
index 8e5d9b7f2..4372e9359 100644
--- a/generator/lua.ml
+++ b/generator/lua.ml
@@ -41,6 +41,7 @@ let generate_lua_c () =
/* It is safe to call deprecated functions from this file. */
#define GUESTFS_NO_WARN_DEPRECATED
+#undef GUESTFS_NO_DEPRECATED
#include <stdio.h>
#include <stdlib.h>
diff --git a/generator/perl.ml b/generator/perl.ml
index 7b89e74e1..efb31077c 100644
--- a/generator/perl.ml
+++ b/generator/perl.ml
@@ -42,6 +42,7 @@ let rec generate_perl_xs () =
/* It is safe to call deprecated functions from this file. */
#define GUESTFS_NO_WARN_DEPRECATED
+#undef GUESTFS_NO_DEPRECATED
#include <stdio.h>
#include <stdlib.h>
diff --git a/generator/php.ml b/generator/php.ml
index 767d48175..b66cfcae2 100644
--- a/generator/php.ml
+++ b/generator/php.ml
@@ -85,6 +85,7 @@ and generate_php_c () =
/* It is safe to call deprecated functions from this file. */
#define GUESTFS_NO_WARN_DEPRECATED
+#undef GUESTFS_NO_DEPRECATED
#include <stdio.h>
#include <stdlib.h>
diff --git a/generator/python.ml b/generator/python.ml
index c67241f5a..7f409b7cd 100644
--- a/generator/python.ml
+++ b/generator/python.ml
@@ -282,6 +282,7 @@ and generate_python_actions actions () =
/* It is safe to call deprecated functions from this file. */
#define GUESTFS_NO_WARN_DEPRECATED
+#undef GUESTFS_NO_DEPRECATED
#include <stdio.h>
#include <stdlib.h>
diff --git a/generator/ruby.ml b/generator/ruby.ml
index 77283c298..76fcb58eb 100644
--- a/generator/ruby.ml
+++ b/generator/ruby.ml
@@ -113,6 +113,7 @@ and generate_ruby_c actions () =
/* It is safe to call deprecated functions from this file. */
#define GUESTFS_NO_WARN_DEPRECATED
+#undef GUESTFS_NO_DEPRECATED
#include <stdio.h>
#include <stdlib.h>
diff --git a/generator/tests_c_api.ml b/generator/tests_c_api.ml
index dd11fd2ae..a4712295a 100644
--- a/generator/tests_c_api.ml
+++ b/generator/tests_c_api.ml
@@ -40,6 +40,7 @@ let rec generate_c_api_tests () =
/* It is safe to call deprecated functions from this file. */
#define GUESTFS_NO_WARN_DEPRECATED
+#undef GUESTFS_NO_DEPRECATED
#include <stdio.h>
#include <stdlib.h>
diff --git a/inspector/Makefile.am b/inspector/Makefile.am
index b1604d8c1..b6dc79027 100644
--- a/inspector/Makefile.am
+++ b/inspector/Makefile.am
@@ -49,6 +49,7 @@ virt_inspector_SOURCES = \
inspector.c
virt_inspector_CPPFLAGS = \
+ -DGUESTFS_NO_DEPRECATED=1 \
-DLOCALEBASEDIR=\""$(datadir)/locale"\" \
-I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \
-I$(top_srcdir)/common/structs -I$(top_builddir)/common/structs \
diff --git a/make-fs/Makefile.am b/make-fs/Makefile.am
index 6190fa78a..3bba3953e 100644
--- a/make-fs/Makefile.am
+++ b/make-fs/Makefile.am
@@ -28,6 +28,7 @@ virt_make_fs_SOURCES = \
make-fs.c
virt_make_fs_CPPFLAGS = \
+ -DGUESTFS_NO_DEPRECATED=1 \
-DLOCALEBASEDIR=\""$(datadir)/locale"\" \
-I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \
-I$(top_srcdir)/common/structs -I$(top_builddir)/common/structs \
diff --git a/rescue/Makefile.am b/rescue/Makefile.am
index 2851ed52e..8ceb57fb4 100644
--- a/rescue/Makefile.am
+++ b/rescue/Makefile.am
@@ -32,6 +32,7 @@ virt_rescue_SOURCES = \
suggest.c
virt_rescue_CPPFLAGS = \
+ -DGUESTFS_NO_DEPRECATED=1 \
-DGUESTFS_PRIVATE=1 \
-DLOCALEBASEDIR=\""$(datadir)/locale"\" \
-I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \
diff --git a/test-tool/Makefile.am b/test-tool/Makefile.am
index 36a6c9788..2daec12ed 100644
--- a/test-tool/Makefile.am
+++ b/test-tool/Makefile.am
@@ -33,6 +33,7 @@ libguestfs_test_tool_CPPFLAGS = \
-I$(top_srcdir)/lib -I$(top_builddir)/lib \
-I$(top_srcdir)/common/options -I$(top_builddir)/common/options \
-I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \
+ -DGUESTFS_NO_DEPRECATED=1 \
-DLOCALEBASEDIR=\""$(datadir)/locale"\"
libguestfs_test_tool_CFLAGS = \
diff --git a/tests/mount-local/Makefile.am b/tests/mount-local/Makefile.am
index f36cd81ba..6231048ff 100644
--- a/tests/mount-local/Makefile.am
+++ b/tests/mount-local/Makefile.am
@@ -29,6 +29,7 @@ check_PROGRAMS = $(TESTS)
test_parallel_mount_local_SOURCES = \
test-parallel-mount-local.c
test_parallel_mount_local_CPPFLAGS = \
+ -DGUESTFS_NO_DEPRECATED=1 \
-I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \
-I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \
-I$(top_srcdir)/lib -I$(top_builddir)/lib \
diff --git a/tests/mountable/Makefile.am b/tests/mountable/Makefile.am
index 058b6856a..efed5c53f 100644
--- a/tests/mountable/Makefile.am
+++ b/tests/mountable/Makefile.am
@@ -27,6 +27,7 @@ check_PROGRAMS = test-internal-parse-mountable
test_internal_parse_mountable_SOURCES = test-internal-parse-mountable.c
test_internal_parse_mountable_CPPFLAGS = \
+ -DGUESTFS_NO_DEPRECATED=1 \
-DGUESTFS_PRIVATE=1 \
-I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \
-I$(top_srcdir)/lib -I$(top_builddir)/lib
diff --git a/tests/parallel/Makefile.am b/tests/parallel/Makefile.am
index 3ea284ab5..5e7b56336 100644
--- a/tests/parallel/Makefile.am
+++ b/tests/parallel/Makefile.am
@@ -26,6 +26,7 @@ check_PROGRAMS = test-parallel
test_parallel_SOURCES = test-parallel.c
test_parallel_CPPFLAGS = \
+ -DGUESTFS_NO_DEPRECATED=1 \
-I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \
-I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \
-I$(top_srcdir)/lib -I$(top_builddir)/lib
--
2.20.1