[glib: 1/2] data-to-c.py: generate new-line at the end of the file
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib: 1/2] data-to-c.py: generate new-line at the end of the file
- Date: Fri, 2 Jul 2021 13:12:43 +0000 (UTC)
commit 3b452cb164b3d731f6391721f898c3d8e6d19392
Author: Michael Olbrich <m olbrich pengutronix de>
Date: Fri Jul 2 14:10:51 2021 +0200
data-to-c.py: generate new-line at the end of the file
This is necessary when building glib with icecc. Icecc splits the build
process into two parts. The file is locally preprocessed with
-fdirectives-only to resolve any includes. This adds linemarkers to the
intermediate file. Without the new-line at the end of the file this:
#include "gconstructor_as_data.h"
#include "glib/glib-private.h"
Is turned into this:
const char gconstructor_code[] = "...";# 1 "glib/glib-private.h"
...
The result is a compile error:
In file included from ../glib/gio/glib-compile-resources.c:45:
gio/gconstructor_as_data.h:1: error: stray '#' in program
gio/gconstructor_as_data.h:1: error: expected identifier or '(' before numeric constant
In file included from ../glib/glib/glib-private.h:22,
from gio/gconstructor_as_data.h:2,
from ../glib/gio/glib-compile-resources.c:45:
../glib/glib/gwakeup.h:27:1: error: unknown type name 'GWakeup'
../glib/glib/gwakeup.h:28:42: error: unknown type name 'GWakeup'
../glib/glib/gwakeup.h:30:42: error: unknown type name 'GWakeup'
../glib/glib/gwakeup.h:32:42: error: unknown type name 'GWakeup'
../glib/glib/gwakeup.h:33:42: error: unknown type name 'GWakeup'
In file included from gio/gconstructor_as_data.h:2,
from ../glib/gio/glib-compile-resources.c:45:
../glib/glib/glib-private.h:98:3: error: unknown type name 'GWakeup'
../glib/glib/glib-private.h:99:58: error: unknown type name 'GWakeup'
../glib/glib/glib-private.h:100:58: error: unknown type name 'GWakeup'
../glib/glib/glib-private.h:102:58: error: unknown type name 'GWakeup'
../glib/glib/glib-private.h:103:58: error: unknown type name 'GWakeup'
In file included from gio/gconstructor_as_data.h:2,
from ../glib/gio/glib-compile-resources.c:45:
../glib/glib/glib-private.h:164:53: warning: file "../glib/gio/glib-compile-resources.c" linemarker
ignored due to incorrect nesting
To avoid this, generate gconstructor_as_data.h with a new-line at the end
of the file.
Signed-off-by: Michael Olbrich <m olbrich pengutronix de>
gio/data-to-c.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/gio/data-to-c.py b/gio/data-to-c.py
index 8a2479eb4..8407fb4af 100755
--- a/gio/data-to-c.py
+++ b/gio/data-to-c.py
@@ -11,7 +11,7 @@ with open(sys.argv[1], "r", encoding="utf-8", errors="backslashreplace") as f:
b = [r"\x{:02x}".format(ord(c)) for c in in_data]
out_data = 'const char {0}[] = "'.format(sys.argv[2])
-out_data += "".join(b) + '";'
+out_data += "".join(b) + '";\n'
with open(sys.argv[3], "w") as f:
f.write(out_data)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]