mirror of
https://github.com/systemd/systemd.git
synced 2024-11-04 13:51:24 +03:00
journal: properly mark two definitions that are deprecated with GCC attributes for that
This commit is contained in:
parent
e7238caf0c
commit
68312977db
@ -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",
|
||||
|
@ -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);
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
|
@ -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]):
|
||||
|
Loading…
Reference in New Issue
Block a user