diff --git a/src/journal-remote/journal-upload.c b/src/journal-remote/journal-upload.c index cc968252887..031e82587d9 100644 --- a/src/journal-remote/journal-upload.c +++ b/src/journal-remote/journal-upload.c @@ -754,9 +754,13 @@ static int open_journal(sd_journal **j) { r = sd_journal_open_directory(j, arg_directory, arg_journal_type); else if (arg_file) r = sd_journal_open_files(j, (const char**) arg_file, 0); - else if (arg_machine) + else if (arg_machine) { +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + /* FIXME: replace with D-Bus call OpenMachineRootDirectory() so that things also work with raw disk images */ r = sd_journal_open_container(j, arg_machine, 0); - else +#pragma GCC diagnostic pop + } else r = sd_journal_open(j, !arg_merge*SD_JOURNAL_LOCAL_ONLY + arg_journal_type); if (r < 0) log_error_errno(r, "Failed to open %s: %m", diff --git a/src/journal/sd-journal.c b/src/journal/sd-journal.c index 837aecdf605..093eb6619e0 100644 --- a/src/journal/sd-journal.c +++ b/src/journal/sd-journal.c @@ -1875,7 +1875,7 @@ _public_ int sd_journal_open_container(sd_journal **ret, const char *machine, in char *p; int r; - /* This is pretty much deprecated, people should use machined's OpenMachineRootDirectory() call instead in + /* This is deprecated, people should use machined's OpenMachineRootDirectory() call instead in * combination with sd_journal_open_directory_fd(). */ assert_return(machine, -EINVAL); diff --git a/src/systemd/_sd-common.h b/src/systemd/_sd-common.h index b3ee7bbc24e..8158ee733e2 100644 --- a/src/systemd/_sd-common.h +++ b/src/systemd/_sd-common.h @@ -45,6 +45,18 @@ typedef void (*_sd_destroy_t)(void *userdata); # define _sd_pure_ __attribute__((__pure__)) #endif +/* Note that strictly speaking __deprecated__ has been available before GCC 6. However, starting with GCC 6 + * it also works on enum values, which we are interested in. Since this is a developer-facing feature anyway + * (as opposed to build engineer-facing), let's hence conditionalize this to gcc 6, given that the developers + * are probably going to use something newer anyway. */ +#ifndef _sd_deprecated_ +# if __GNUC__ >= 6 +# define _sd_deprecated_ __attribute__((__deprecated__)) +# else +# define _sd_deprecated_ +# endif +#endif + #ifndef _SD_STRINGIFY # define _SD_XSTRINGIFY(x) #x # define _SD_STRINGIFY(x) _SD_XSTRINGIFY(x) diff --git a/src/systemd/sd-journal.h b/src/systemd/sd-journal.h index b4bf3b91762..dbca4ebce22 100644 --- a/src/systemd/sd-journal.h +++ b/src/systemd/sd-journal.h @@ -70,7 +70,7 @@ enum { SD_JOURNAL_CURRENT_USER = 1 << 3, SD_JOURNAL_OS_ROOT = 1 << 4, - SD_JOURNAL_SYSTEM_ONLY = SD_JOURNAL_SYSTEM /* deprecated name */ + SD_JOURNAL_SYSTEM_ONLY _sd_deprecated_ = SD_JOURNAL_SYSTEM /* deprecated name */ }; /* Wakeup event types */ @@ -85,7 +85,7 @@ int sd_journal_open_directory(sd_journal **ret, const char *path, int flags); int sd_journal_open_directory_fd(sd_journal **ret, int fd, int flags); int sd_journal_open_files(sd_journal **ret, const char **paths, int flags); int sd_journal_open_files_fd(sd_journal **ret, int fds[], unsigned n_fds, int flags); -int sd_journal_open_container(sd_journal **ret, const char *machine, int flags); /* deprecated */ +int sd_journal_open_container(sd_journal **ret, const char *machine, int flags) _sd_deprecated_; /* deprecated */ void sd_journal_close(sd_journal *j); int sd_journal_previous(sd_journal *j); diff --git a/src/test/generate-sym-test.py b/src/test/generate-sym-test.py index 4d358b8e345..fdb9e3ecb78 100755 --- a/src/test/generate-sym-test.py +++ b/src/test/generate-sym-test.py @@ -6,6 +6,9 @@ for header in sys.argv[2:]: print('#include "{}"'.format(header.split('/')[-1])) print(''' +/* We want to check deprecated symbols too, without complaining */ +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + const void* symbols[] = {''') for line in open(sys.argv[1]):