aboutsummaryrefslogtreecommitdiffstats
path: root/src/scanner.c
Commit message (Collapse)AuthorAgeFilesLines
* scanner: use separate guards for validator functionsSimon Ser2025-02-231-3/+11
| | | | | | | | | | | | | | Generated XXX_is_valid() functions for enums are guarded behind the same #define as the enum itself. This worked fine until recently, but since fbd7460737c9 ("scanner: add new enum-header mode") we're also generating enum-only headers. When including the enum-only header first, and then the server header, the validator functions are missing. Define a separate guard to fix this. Signed-off-by: Simon Ser <contact@emersion.fr>
* scanner: fix validator for bitfieldsSimon Ser2024-07-091-12/+25
| | | | | | | Bitfields are valid if the value only contains bits inside of the supported entries for the given version. Signed-off-by: Simon Ser <contact@emersion.fr>
* scanner: extract validator function emission to helper functionSimon Ser2024-07-091-26/+33
| | | | | | This function will grow in the next commit. Signed-off-by: Simon Ser <contact@emersion.fr>
* Add support for the deprecated-since XML attributeSimon Ser2024-04-241-7/+47
| | | | | | | | | | | | | | This marks a request, event or enum entry as deprecated since a given version. Note that it's not clear what it means if an entry is deprecated at some version, and the enum is used from some completely different interface than where it was defined. However, that's a more general issue with enums, see: https://gitlab.freedesktop.org/wayland/wayland/-/issues/435 Signed-off-by: Simon Ser <contact@emersion.fr> References: https://gitlab.freedesktop.org/wayland/wayland/-/issues/89
* scanner: add validators for enumsSimon Ser2024-04-231-4/+32
| | | | | | | | | | | | | | Right now compositors need to manually check that enum values sent by the client are valid. In particular: - Check that the value sent by the client is not outside of the enum. - Check that the version of the enum entry is consistent with the object version. Automatically generate validator functions to perform these tasks. Signed-off-by: Simon Ser <contact@emersion.fr> Closes: https://gitlab.freedesktop.org/wayland/wayland/-/issues/104
* scanner: add new enum-header modeSimon Ser2024-03-281-1/+36
| | | | | | | This generates a header with only enum definitions. This is useful to share enum headers between libraries and library users. Signed-off-by: Simon Ser <contact@emersion.fr>
* scanner: Fix undefined behavior around qsortFergus Dall2023-01-031-2/+7
| | | | | | | | | According to clang, qsort cannot be passed a null pointer, even if the size is specified to be zero. The scanner can hit this while trying to sort forward declarations if it happens to be building a protocol file that doesn't require any, either in the header or the source. Signed-off-by: Fergus Dall <sidereal@google.com>
* Do not allow nullable `new_id`Ian Douglas Scott2022-07-141-1/+0
| | | | | | | | The usefulness of this is limited, and `libwayland-client` doesn't provide a way to pass a null `new_id` since the id is generated by the library and given to the caller as the return value. Signed-off-by: Ian Douglas Scott <idscott@system76.com>
* Do not allow nullable arrays, which were not correctly implementedIan Douglas Scott2022-07-141-2/+1
| | | | | | | | | | | Nullable arrays, which are not used anywhere, were marshalled the same way as an empty non-null array. The demarshalling logic did not recognize anything as a null array. Given this, it seems better to just explicitly not support it. Fixes https://gitlab.freedesktop.org/wayland/wayland/-/issues/306. Signed-off-by: Ian Douglas Scott <idscott@system76.com>
* scanner: Use the new atomic marshal/destroy functionDerek Foreman2021-08-071-33/+30
| | | | | | | | | | | | | | | | Use the new flagged marshal+destroy function in generated code. It's intended as a replacement for all existing wl_proxy_marshal_* functions, so I've used it to replace them all. This results in a large update to the scanner test files as well. We now pass the new WL_MARSHAL_FLAG_DESTROY flag when appropriate, so the race condition in #86 caused by releasing the display mutex between marshalling the proxy and destroying the proxy is now gone. Fixes #86 Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
* scanner: Use descriptions in entriesJames Legg2021-07-071-1/+16
| | | | | | | | | | | | | | | entry may have a description according to the DTD. This is used in some protocols including xdg-shell. Fixes the code comment on an enum declaration using the description of the last enum that had one, adds the descriptions to the comments on enumerators, and avoids leaking the previously missing descriptions. Fixes #208 Signed-off-by: James Legg <lankyleggy@gmail.com> Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
* build: replace assembly embedding with Python scriptSimon Ser2021-05-101-5/+5
| | | | | | | | This allows Meson to properly track dependencies and re-build the scanner when editing the dtd. We also stop depending on GNU as' .incbin and make the embedding less obscure. Signed-off-by: Simon Ser <contact@emersion.fr>
* scanner: Guard interface declarationsGuido Günther2020-04-231-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This allows to include client and server headers in the same file fixing warnings like In file included from ../subprojects/wlroots/include/wlr/types/wlr_layer_shell_v1.h:16, from ../src/desktop.h:16, from ../src/server.h:13, from ../tests/testlib.c:8: tests/59830eb@@footest@sta/wlr-layer-shell-unstable-v1-protocol.h:80:34: warning: redundant redeclaration of ‘zwlr_layer_shell_v1_interface’ [-Wredundant-decls] 80 | extern const struct wl_interface zwlr_layer_shell_v1_interface; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from ../tests/testlib.h:8, from ../tests/testlib.c:7: tests/59830eb@@footest@sta/wlr-layer-shell-unstable-v1-client-protocol.h:77:34: note: previous declaration of ‘zwlr_layer_shell_v1_interface’ was here 77 | extern const struct wl_interface zwlr_layer_shell_v1_interface; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from ../subprojects/wlroots/include/wlr/types/wlr_layer_shell_v1.h:16, from ../src/desktop.h:16, from ../src/server.h:13, from ../tests/testlib.c:8: tests/59830eb@@footest@sta/wlr-layer-shell-unstable-v1-protocol.h:106:34: warning: redundant redeclaration of ‘zwlr_layer_surface_v1_interface’ [-Wredundant-decls] 106 | extern const struct wl_interface zwlr_layer_surface_v1_interface; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from ../tests/testlib.h:8, from ../tests/testlib.c:7: tests/59830eb@@footest@sta/wlr-layer-shell-unstable-v1-client-protocol.h:103:34: note: previous declaration of ‘zwlr_layer_surface_v1_interface’ was here 103 | extern const struct wl_interface zwlr_layer_surface_v1_interface; Signed-off-by: Guido Günther <agx@sigxcpu.org> Closes: #158
* scanner: include config.h from command linePekka Paalanen2020-01-101-1/+0
| | | | | | | | Meson will need to build wayland-scanner twice with different config.h files, once for build and another for host machine. It will be easier to include the right config.h from compiler command line than playing with files. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
* scanner: Add configure check for strndupJoshua Watt2019-11-051-0/+11
| | | | | | | Some platforms may not have strndup() (e.g. MinGW), so provide a equivalent implementation if it's not found. Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
* scanner: prepend protocol name to types symbolMarty E. Plummer2019-09-111-5/+5
| | | | | | | | | | When doing unity builds via meson (example project: https://github.com/swaywm/sway) multiple source files are glued together via #include directives. Having every wayland-scanner generated source file have an identifier named '*types[]' will lead to errors in these unity builds if two or more of these are joined. Signed-off-by: Marty E. Plummer <hanetzer@startmail.com>
* log: remove "%m" from format strings by using strerror(errno)Antonio Borneo2019-05-021-1/+1
| | | | | | | | | | | | | | | | | The printf() format specifier "%m" is a glibc extension to print the string returned by strerror(errno). While supported by other libraries (e.g. uClibc and musl), it is not widely portable. In Wayland code the format string is often passed to a logging function that calls other syscalls before the conversion of "%m" takes place. If one of such syscall modifies the value in errno, the conversion of "%m" will incorrectly report the error string corresponding to the new value of errno. Remove all the occurrences of the specifier "%m" in Wayland code by using directly the string returned by strerror(errno). Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
* scanner: error when element names will not compileManuel Stoeckl2019-05-021-1/+60
| | | | | | | | | | | | | | | | | | | | This change checks that the "name" fields of the various structures in a Wayland protocol XML file will be converted into C identifiers that can be successfully compiled. For names which will be inserted as the prefix of an identifier enforce a match with [_a-zA-Z][_0-9a-zA-Z]* . For types only inserted as the suffix of an identifier (enum, entry), enforce a format of [_0-9a-zA-Z]+ . Unicode characters (and escape sequences like \u0394) are not allowed, because most older and some newer C compilers do not support them by default. For sake of simplicity, this patch does not check for collisions with reserved words or standard library names. Signed-off-by: Manuel Stoeckl <code@mstoeckl.com>
* scanner: Reverse expat/libxml include orderDaniel Stone2018-08-291-1/+4
| | | | | | | | | | | | | | | | libxml2 unconditonally defines XMLCALL to nothing. Expat does not redefine XMLCALL if it is already defined, but if it is not, and we are building with gcc on i386 (not x86-64), it will define it as 'cdecl'. Including Expat before libxml thus results in a warning about XMLCALL being redefined. Luckily we can get around this by just reversing the include order: cdecl is a no-op on Unix-like systems, so by having libxml first define XMLCALL to nothing and including Expat afterwards, we avoid the warning and lose nothing. Signed-off-by: Daniel Stone <daniels@collabora.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
* scanner: Mark fail() as noreturnDaniel Stone2018-08-291-1/+1
| | | | | | | | | Help static analysers by letting them know that once we fail(), execution will terminally complete. Signed-off-by: Daniel Stone <daniels@collabora.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
* scanner: Plug two memory leaksDaniel Stone2018-08-291-0/+2
| | | | | | | | | | | Found with both ASan leak sanitizer and Valgrind. We were trivially leaking the enum name for every arg parsed by the scanner which had one. If libxml-based DTD validation was enabled, we would also leak the DTD itself, despite diligently freeing the document, context, etc. Signed-off-by: Daniel Stone <daniels@collabora.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
* scanner: allow referencing foreign enumsSimon Ser2018-06-071-6/+1
| | | | | | | | | It's already possible to reference foreign interfaces, so it should also be possible to reference foreign enums. Signed-off-by: Simon Ser <contact@emersion.fr> Reviewed-by: Silvan Jegen <s.jegen@gmail.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
* scanner: Fix broken private-code generationDerek Foreman2018-02-231-1/+1
| | | | | | Missing a closing bracket. Reviewed-by: Daniel Stone <daniels@collabora.com>
* scanner: make use of __has_attribute()Emil Velikov2018-02-221-1/+5
| | | | | | | | | A more generic way to evaluating various attributes, __has_attribute is available with gcc, clang, even the Oracle/Sun compiler. Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk> Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
* scanner: introduce "public-code" and "private-code"Emil Velikov2018-02-221-6/+44
| | | | | | | | | | | | | | | | The options are used to indicate how the code will be used - will it be public, as part of a DSO or private. In nearly every instance, people want to use the latter. One noticeable exception is the wayland libraries. They provide the base marshalling protocol that everyone uses. The option "code" was deprecated in favour of "public-code" with a warning message produced to guide people. Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk> Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
* scanner: Add --strict flagJonas Ådahl2017-12-041-2/+13
| | | | | | | | Add a --strict flag for making wayland-scanner fail if the DTD verification fails. This is useful for testing, so that a test case can fail a scan when the protocol doesn't comply with the DTD. Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
* scanner: use tabs for indentation.Emil Velikov2017-08-181-3/+3
| | | | | | | File uses tabs, barring the few instances fixed with this patch. Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
* scanner: Reword fallthrough comment to quiet GCCDaniel Stone2017-03-171-3/+1
| | | | | | | | | | | GCC 7 now requires an explicit comment noting that case statements without a break fall through. We already had one of those in the scanner, but GCC wasn't smart enough to pick it up. Quiet the warning by making the comment less elaborate. Signed-off-by: Daniel Stone <daniels@collabora.com> Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
* scanner: support "since" attribute for enum entriesPeter Hutterer2017-01-241-4/+30
| | | | | | | | | | | | | | | | | | | This was already in the DTD but not supported by the scanner. The check for ever-increasing "since" tags is not strictly required for enum entries as we control the binary value. But it keeps the xml file in good order, preventing things like: <entry name="first" value="…" /> <entry name="second" value="…" since="3"/> <entry name="third" value="…" since="2"/> <entry name="fourth" value="…" since="3"/> If this is undesirable in the future the check can be removed without side-effects. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
* scanner: add helper function to convert "since" to a versionPeter Hutterer2017-01-241-11/+22
| | | | | | | | | Same code we already had, just moved into a helper function Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Yong Bakos <ybakos@humanoriented.com> Reviewed-by: Daniel Stone <daniels@collabora.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
* scanner: Fixed doxygen group name for _add_listenerBill Spitzak2016-11-161-1/+1
| | | | | Signed-off-by: Bill Spitzak <spitzak@gmail.com> Acked-by: Yong Bakos <ybakos@humanoriented.com>
* scanner: Remove return doxygen annotationYong Bakos2016-11-101-1/+1
| | | | | | | | | Replace \returns with just Returns, as this is not a doxygen comment block. (Avoids differing with the existing convention of \return for return values.) Signed-off-by: Yong Bakos <ybakos@humanoriented.com> Reviewed-by: Bryce Harrington <bryce@osg.samsung.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
* scanner: Generate all SINCE_VERSION macros for everyoneQuentin Glidic2016-08-111-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | Practical example: a client supporting version 2 of wl_output will wait for the wl_output.done event before starting wl_output-related operations. However, if the server only supports version 1, no event will ever come, and it must fallback to use the wl_output.geometry event alone. Without this macro, it cannot check for that in a nice way. This patch introduces the same #defines in both server and client headers. We rely on both being generated from the same XML file and https://gcc.gnu.org/onlinedocs/cpp/Undefining-and-Redefining-Macros.html to not cause compiler errors or warning due to redefinitions. We also assume that no-one uses the same name in the same interface for both a request and an event. If this patch does cause grief due to identical redefinitions, the contingency plan is to change the generator to produce #ifndef/#define/#endif instead of just #define. Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk> [Pekka: add paragraphs to commit message.]
* (multiple): Include stdint.hYong Bakos2016-07-251-0/+1
| | | | | | | | | | Some headers and source files have been using types such as uint32_t without explicitly including stdint.h. Explicitly include stdint.h where appropriate. Signed-off-by: Yong Bakos <ybakos@humanoriented.com> Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
* scanner: Use uint32_t instead of uintKhem Raj2016-07-181-1/+1
| | | | | | | uint32_t is C99 defined stdint type Signed-off-by: Khem Raj <raj.khem@gmail.com> Reviewed-by: Daniel Stone <daniels@collabora.com>
* scanner: Improve documentation for strtouint()Bryce Harrington2016-07-111-2/+11
| | | | | Signed-off-by: Bryce Harrington <bryce@osg.samsung.com> Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
* scanner: Move PROGRAM_NAME defineYong Bakos2016-06-071-2/+2
| | | | | | | | | | PROGRAM_NAME was defined within the if block of HAVE_LIBXML, causing a compilation failure when libxml is not present. Move the define of PROGRAM_NAME out of the if block. Signed-off-by: Yong Bakos <ybakos@humanoriented.com> Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
* scanner: Replace #define tab with spaceYong Bakos2016-06-071-2/+2
| | | | | | | | | | | | | wayland-client-protocol.h and wayland-server-protocol.h use a tab between the identifier and token of generated #defines for request/event opcodes and versions. While this sometimes enables vertical alignment, it more frequently doesn't, and leads to awkward spacing. Replace the tab with a space, for consistency and readability. Signed-off-by: Yong Bakos <ybakos@humanoriented.com> Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net> Tested-by: Quentin Glidic <sardemff7+git@sardemff7.net>
* scanner: Fix reported executable name to 'wayland-scanner'Bryce Harrington2016-06-071-6/+8
| | | | | | | | | | | | | | 'wayland-scanner -v' (correctly) reports the program as named "wayland-scanner", but 'wayland-scanner -h' was inconsistent, referring to it as './scanner'. Also refactor this and other references to the program name to use a common #define, PROGRAM_NAME. Signed-off-by: Bryce Harrington <bryce@osg.samsung.com> Reviewed-by: Jonas Ådahl <jadahl@gmail.com> Reviewed-by: Yong Bakos <ybakos@humanoriented.com> Tested-by: Yong Bakos <ybakos@humanoriented.com>
* scanner: Remove unused forward decs from client protocolYong Bakos2016-05-201-4/+4
| | | | | | | | | | | | wayland-client-protocol.h had forward declarations for wl_client and wl_resource, yet nothing on the client side references these types. Add a 'side' condition to only generate these forward declarations in the server protocol header. Signed-off-by: Yong Bakos <ybakos@humanoriented.com> Reviewed-by: <pekka.paalanen@collabora.co.uk> Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
* scanner: Add version argument to wayland-scannerArmin Krezović2016-05-061-2/+24
| | | | | | | | | | | | | | | | This adds a command line argument to print wayland-scanner version. It also makes wayland-scanner emit a comment with wayland library version to every file it generates. v2: separate variable definitions into their own lines and remove old style "version" argument Reviewed-by: Bryce Harrington <bryce@osg.samsung.com> Reviewed-by: Yong Bakos <ybakos@humanoriented.com> Tested-by: Yong Bakos <ybakos@humanoriented.com> Signed-off-by: Armin Krezović <krezovic.armin@gmail.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
* protocol: add support for cross-interface enum attributesAuke Booij2016-05-031-16/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The enum attribute, for which scanner support was introduced in 1771299, can be used to link message arguments to <enum>s. However, some arguments refer to <enum>s in a different <interface>. This adds scanner support for referring to an <enum> in a different <interface> using dot notation. It also sets the attributes in this style in the wayland XML protocol (wl_shm_pool::create_buffer::format to wl_shm::format, and wl_surface::set_buffer_transform::transform to wl_output::transform), and updates the documentation XSL so that this new style is supported. Changes since v2: - add object:: prefix for all enumerations in the documentation - fix whitespace in scanner.c - minor code fixup to return early and avoid casts in scanner.c Changes since v1: - several implementation bugs fixed Signed-off-by: Auke Booij <auke@tulcod.com> Reviewed-by: Nils Christopher Brause <nilschrbrause@googlemail.com> Reviewed-by: Bill Spitzak <spitzak@gmail.com> [Pekka: rebased across cde251a124d41977b447098cc530fcad2834a45f] [Pekka: wrap lines and space fixes in scanner.c] Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
* scanner: move include directives before extern "C" wrapperEmil Velikov2016-04-191-3/+3
| | | | | | | | | | | | Adding extern "C" wrapper before includes (especially system ones) is illadvised as the headers themselves can behave diffently in that case. See the section "Including C Headers in C++ Code" in the following http://www.oracle.com/technetwork/articles/servers-storage-dev/mixingcandcpluspluscode-305840.html Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk> Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
* scanner: Fix spacing of @paramYong Bakos2016-04-011-1/+1
| | | | | | | | Adds one space to the @param lines in generated .h files, aligning the indentation with the rest of the comment block. Signed-off-by: Yong Bakos <ybakos@humanoriented.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
* doc: generate doxygen html output from the scannerPeter Hutterer2016-03-071-75/+143
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This switches the scanner to generate doxygen-compatible tags for the generated protocol headers, and hooks up the doxygen build to generate server and client-side API documentation. That documentation is now in Client/ and Server/, respectively. GENERATE_HTML is on by default and must be disabled for the xml/man targets to avoid messing up the new documentation. We disable all three three targets in the doxyfile (xml and man default to NO anyway) to make it obvious that they need to be set in the per-target instructions. Each protocol is a separate doxygen @page, with each interface a @subpage. Wayland only has one protocol, wayland-protocols will have these nested. Each protocol page has a list of interfaces and the copyright and description where available. All interfaces are grouped by doxygen @defgroup and @ingroups and appear in "Modules" in the generated output. Each interface subpage has the description and a link to the actual API doc. Function, struct and #defines are documented in doxygen style and associated with the matching interface. Note that pages and groups have fixed HTML file names and are directly linkable/bookmark-able. The @mainpage is a separate file that's included at build time. It doesn't contain much other than links to where the interesting bits are. It's a static file though that supports markdown, so we can extend it easily in the future. For doxygen we need the new options EXTRACT_ALL and OPTIMIZE_OUTPUT_FOR_C so it scans C code properly. EXTRACT_STATIC is needed since most of the protocol hooks are static. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
* build: fix ./configure --disable-dtd-validationPekka Paalanen2016-02-291-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | When configured with --disable-dtd-validation: CPPAS src/dtddata.o src/dtddata.S: Assembler messages: src/dtddata.S:39: Error: file not found: src/wayland.dtd.embed Makefile:1520: recipe for target 'src/dtddata.o' failed This is because the variable name used does not match the implicit variable name in autoconf. Fix the variable name, making both --disable-dtd-validation and --enable-dtd-validation to what they should. Do not try to build dtddata.S if dtd-validation is disabled. It depends on wayland.dtd.embed which is created by configure only if dtd-validation is enabled. If not building dtddata.S, also make sure the extern definitions in scanner.c are compiled out. Bugzilla: https://bugs.gentoo.org/show_bug.cgi?id=575212 Reported-by: leio@gentoo.org Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk> Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net> Tested-by: Bryce Harrington <bryce@osg.samsung.com>
* scanner: Fix oddities in copyright printingDerek Foreman2016-02-041-6/+10
| | | | | | | | | | | | | | | | | | Some copyright strings could result in broken generated header files with unmatched */ This change: Runs the loop long enough so the copyright[i] == 0 test can actually happen. (if there was no \n no copyright text was printed, */ still was) Prints the opening /* even if there was whitespace at the start of the very first line. Only emits a */ if a /* was printed. Signed-off-by: Derek Foreman <derekf@osg.samsung.com> Reviewed-by: Jon A. Cruz <jonc@osg.samsung.com> Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
* scanner: Print filename on DTD validation errorJonas Ådahl2016-02-011-5/+10
| | | | | | | | | | | | Don't just print prefix the errors with "protocol", but the actual file name, if wayland-scanner was passed with the filename of the protocol file. If wayland-scanner is reading from stdin, errors will be prefixed with "<stdin>" instead of "protocol". Signed-off-by: Jonas Ådahl <jadahl@gmail.com> Reviewed-by: David Fort <contact@hardening-consulting.com> Reviewed-by: Derek Foreman <derekf@osg.samsung.com> Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
* Track protocol object versions inside wl_proxy.Jason Ekstrand2016-01-191-8/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This provides a standardized mechanism for tracking protocol object versions in client code. The wl_display object is created with version 1. Every time an object is created from within wl_registry_bind, it gets the bound version. Every other time an object is created, it simply inherits it's version from the parent object that created it. (comments and minor reformatting added by Derek Foreman <derekf@osg.samsung.com>) Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk> Second trivial commit squashed into this one: Authored by Derek Foreman <derekf@osg.samsung.com> Signed-off-by: Derek Foreman <derekf@osg.samsung.com> (it's literally one of code and a lot of comments) This sets wl_display's version (for proxy version query purposes) to 0. Any proxy created with unversioned API (this happens when a client compiled with old headers links against new wayland) will inherit this 0. This gives us a way for new libraries linked by old clients to realize they can't know a proxy's version. wl_display's version being unqueryable (always returning 0) is an acceptable side effect, since it's a special object you can't bind specific versions of anyway. Second half: Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk> Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
* scanner: Fail if 'since' is higher than the interface versionJonas Ådahl2016-01-121-1/+5
| | | | | | | | | | | If an event or request have a "since" attribute that is larger than the version of the interface it is in, fail with an explaining error message. Signed-off-by: Jonas Ådahl <jadahl@gmail.com> Reviewed-by: Daniel Stone <daniels@collabora.com> Reviewed-by: Marek Chalupa <mchqwerty@gmail.com> Reviewed-by: Derek Foreman <derekf@osg.samsung.com>