mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-09-28 18:16:34 +02:00
codegen: Use -
instead of stdout
for output to stdout
In command-line tools, ordinary filenames normally do not have
special-cased meanings, so commit 3ef742eb
"Don't skip dbus-codegen tests
on Win32" was a command-line API break: in the unlikely event that a
user wanted to write to a file named exactly `stdout`, this would have
been an incompatible change.
There is a conventional pseudo-filename to represent standard output,
which is `-` (for example `cat -` is a no-op filter). Adding support
for this is technically also a command-line API break (in the very
unlikely event that a user wants to write to a file named exactly `-`,
they would now have to write it as `./-`), but filenames starting with
a dash often require special treatment anyway, so this probably will not
come as a surprise to anyone.
When the output filename is `-` we don't want to use `#ifdef _____` as
a header guard, so special-case it as `__STDOUT__` as before.
Signed-off-by: Simon McVittie <smcv@collabora.com>
This commit is contained in:
@@ -57,6 +57,9 @@ def generate_namespace(namespace):
|
||||
|
||||
|
||||
def generate_header_guard(header_name):
|
||||
if header_name == "-":
|
||||
return "STDOUT"
|
||||
|
||||
# There might be more characters that are safe to use than these, but lets
|
||||
# stay conservative.
|
||||
safe_valid_chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||
|
Reference in New Issue
Block a user