summaryrefslogtreecommitdiff
path: root/giscanner
Commit message (Collapse)AuthorAgeFilesLines
* Clean shebangs out of non-executable scripts and drop exec perm from ↵Dominique Leuenberger2019-01-095-4/+0
| | | | xmlwriter.py
* tests: add some tests for get_source_root_dirsChristoph Reiter2019-01-081-2/+2
| | | | | To make it easier to test make sure it always returns absolute paths. Also fix a typo, oops!
* get_source_root_dirs: handle empty file list case. Fixes #257Christoph Reiter2019-01-081-0/+3
| | | | | | While scannermain checks that at least one filename is given, it filters them based on the file extension after that, so we still need to handle an empty file list laster on.
* scanner: Flatten multi-dimensional arrays fieldsTomasz Miąsko2019-01-071-10/+17
| | | | | | | | | | | | | Provide partial support for multi-dimensional arrays by representing them as flattened one dimensional array with size that is equal to product of sizes in each dimension. Previously only the first dimension would be actually used. This should be sufficient to ensure that those fields have layout compatible with C, without using nested array types that are currently unsupported by vapigen Issue #255.
* scanner: Remove incorrect c:type generated for array of synthesized unionsTomasz Miąsko2019-01-061-4/+2
| | | | | | | | This also reverts workaround introduced to support this use case in f77cfc4275b1fba4f9fedea6e40b00e0ebbe142c, since it is no longer necessary. Fixes issue #141.
* scanner: Remove incorrect c:type from fields with array typeTomasz Miąsko2019-01-061-12/+1
| | | | | | | | | | Neither `_create_source_type` nor `_create_complete_source_type` actually support fixed size arrays, so previously generated C types were incorrect. Remove C types from array fields instead of producing incorrect ones. Fixes issue #145.
* scanner: rework source root guessing codeChristoph Reiter2019-01-061-3/+24
| | | | | | | | | | | | commonprefix doesn't work on relative paths and doesn't return directories so so for the g-i build case it returned an empty string resulting in paths relative to the working directory, making the build not reproducible. To somehwat improve this make sure the paths are absolute, use commonpath and if no common dir can be found just fall back to passing all directories so we only write the basenames. I guess we should look into passing --sources-top-dirs in the g-i build.
* scanner: Merge specifiers and qualifiers when merging basic types.Tomasz Miąsko2019-01-051-0/+5
|
* scanner: Merge basic types in `specifier_qualifier_list` production.Tomasz Miąsko2019-01-051-10/+11
| | | | | | | | | | | This is necessary to parse types like `unsigned char` or `long double`, and is already done when parsing `declarations_specifiers`. Examples that are fixed by this change include: * `GLib.TestLogMsg.nums` previously parsed as `long` but should be `long double`. * `GMime.Encoding.uubuf` previously parsed as `unsigned` but should be `unsigned char`.
* meson: port doctool testsChristoph Reiter2019-01-031-0/+12
|
* ci: enable -Werror for msys2+mesonChristoph Reiter2019-01-011-6/+9
|
* customize_compiler: also replace the linker command if CC is setChristoph Reiter2018-12-301-1/+4
| | | | | | | | Otherwise when you set CC=clang then distuils will still use gcc for linking. While it seems we don't invoke the link command atm this shouldn't hurt. The upstream customize_compiler() does the same thing on macOS and there is a bug for enabling it everywhere: https://bugs.python.org/issue24935
* Do not bail out when parsing GIR files without doc positionsEmmanuele Bassi2018-12-291-2/+2
| | | | | | | The position attributes on a <doc> element are not mandatory, so we should have some fallback value if they are missing. Fixes: #252
* ccompiler: don't use Python compiler flags. Fixes #150Christoph Reiter2018-12-291-6/+8
| | | | | | | Only use flags provided by env vars from the user and never from the Python sysconfig. The sysconfig values depend on the way Python was built, might conflict when using g-i with a different compiler and can't be controlled by the g-i user.
* ccompiler: include a version of customize_compiler() from CPythonChristoph Reiter2018-12-291-1/+50
| | | | | | | | So we have more control over it. This also removes all macOS specific bits from it because I'm not sure if they are needed and they depend in internal API. This means this change can cause functional changes. Please report if you hit any!
* Test commands executed by unix C compiler.Tomasz Miąsko2018-12-291-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | No functional changes intended. Tests check that: * Compiler is obtained from CC. * cc is used as the default compiler. Currently not true as a Python build time compiler is used as the default. * Preprocessor is obtained from CC when CPP is unspecified by adding -E. * Preprocessor is obtained from CPP. * cpp is used as the default preprocessor. Currently not true as Python build time preprocessor is used as the default. * Shell word splitting rules are used to split CC. * Shell word splitting rules are used to split CPP. * Deprecation warnings are disabled during compilation. * Preprocessing step includes CPPFLAGS. * Compilation step includes both CFLAGS and CPPFLAGS, in that order. * Macros from CFLAGS are defined only once. Currently not true as they are defined twice. * Flags that would retain macros after preprocessing step are filtered out. Currently only partially true as they aren't filtered out from CPPFLAGS. * Preprocessing step includes flag that preserves comments. * Preprocessing step includes current working directory. * Complete preprocessing command doesn't contain anything unexpected. Currently not true as Python build time CPPFLAGS are included as well. * Complete build command doesn't contain anything unexpected. Currently not true as Python build time CFLAGS and CPPFLAGS are included as well.
* scanner: make using bool without stdbool include work again. Fixes #247Christoph Reiter2018-12-212-1/+2
| | | | | | | | | With !45 special casing of bool in the lexer was removed which previously allowed the usage of bool without including stdbool.h. This breaks scanning of graphene headers which guarded the stdbool include with __GI_SCANNER__ (I haven't figured out why). Add back the special handling for bool in the lexer and also map it to gboolean like _Bool as if stdbool.h was included.
* docwriter: Support markdown 3.x. Fixes #250Christoph Reiter2018-12-201-3/+14
| | | | | The headerid extension no longer exists in 3.x. Use the toc extension instead. The toc_depth option was only added in 3.x so still try headerid first.
* meson: add default compiler warning flags and enable -Werror on CIChristoph Reiter2018-12-181-2/+6
| | | | | | | | This enables various compiler warnings project wide and disables the triggered ones for each library/executable. This should give us roughly the same behaviour as with autotools. Tested with gcc8 and clang7.
* meson: only link against libpython on WindowsChristoph Reiter2018-12-171-1/+8
| | | | | Like we currently do with autotools. See https://github.com/mesonbuild/meson/issues/4117
* meson: install everything.c/h like with autotoolsChristoph Reiter2018-12-171-1/+4
| | | | | | This requires a code change in codegen.py to support the case whre output files are not installed in the working directory. Instead of using the output path for the header include use the relative path to the output source file.
* meson: build/install mdextensions.py; and add a simple testChristoph Reiter2018-12-171-0/+1
| | | | | Add a simple test using the docwriter so we trigger the docwriter related Python imports.
* Save preprocessor input and output files with save-tempsTomasz Miąsko2018-12-171-2/+5
| | | | | | | | | | When using `GI_SCANNER_DEBUG=save-temps`, the temporary input file to be preprocessed and temporary output file that is result of this preprocessing are retained for debugging purposes. Use together with `-v` option to actually determine names of those temporary files. This should make it easier to determine the source of parsing errors, like those described in the #247.
* Merge branch 'sourcescanner-empty-delcs' into 'master'Christoph Reiter2018-12-091-0/+4
|\ | | | | | | | | | | | | sourcescanner: Allow empty declarations. Fixes #216 Closes #216 See merge request GNOME/gobject-introspection!89
| * sourcescanner: Allow empty declarations. Fixes #216Christoph Reiter2018-12-091-0/+4
| | | | | | | | | | As far as I see these are not valid C and only allowed in C++11. But they do occur in the wild (mingw headers) so let's try to handle them.
* | Replace linked lists with arrays in source scannerTomasz Miąsko2018-12-095-62/+53
|/ | | | Reduce total number of memory allocations and increase data locality.
* Ignore __pragma keyword used by MSVCTomasz Miąsko2018-12-081-0/+1
|
* Merge branch 'drop-py-compat-code' into 'master'Christoph Reiter2018-12-0825-184/+7
|\ | | | | | | | | Drop all Python 2 compat code See merge request GNOME/gobject-introspection!85
| * Drop all Python 2 compat codeChristoph Reiter2018-12-0825-184/+7
| | | | | | | | We only support 3.4+ now.
* | sourcescanner: collect error messages and expose themChristoph Reiter2018-12-087-8/+56
| | | | | | | | | | | | | | | | | | | | | | It just printed errors to stderr and always returns success even if parsing fails. This prevents us to write any tests for it. As a first step collect all lexing/parsing error messages and print them to stderr after the scanner is done. This allows us to add some regression tests for !78. In the future we probably want to raise an exception with those errors if parsing fails.
* | cachestore: don't try to catch nonexisting pickle.BadPickleGet. Fixes #159Christoph Reiter2018-12-081-1/+1
|/ | | | | pickle.loads() can pretty much throw any kind of exception and we can't handle it besides ignoring it, so just catch all.
* Merge branch 'scan-file-use-filename' into 'master'Christoph Reiter2018-12-074-117/+27
|\ | | | | | | | | gi_source_scanner_parse_file: use a filename instead of a FILE struct See merge request GNOME/gobject-introspection!79
| * gi_source_scanner_parse_file: use a filename instead of a FILE structChristoph Reiter2018-12-064-117/+27
| | | | | | | | | | | | This allows us to get rid of the msvc hacks which are needed in case Python is built with a different msvc than g-i. By passing a filename the FILE struct never passes over library boundaries.
* | Merge branch 'typeof' into 'master'Christoph Reiter 🐍2018-12-061-2/+2
|\ \ | |/ |/| | | | | scanner: Replace use of typeof with void token See merge request GNOME/gobject-introspection!78
| * scanner: Replace use of typeof with void tokenTomasz Miąsko2018-12-041-2/+2
| | | | | | | | | | | | This makes it possible to parse inputs where typeof is used as part of cast expression, e.g., in g_object_ref macro expansion. Selection of VOID is arbitrary since there is no actual implementation of typeof.
* | giscanner/girwriter.py: Fix running on WindowsChun-wei Fan2018-12-061-1/+8
|/ | | | | | | ... When we are building in a drive that is different from the drive that we are acquiring the depedencies from. For example, os.path.relpath() does not like it when we we are building G-I on D:\foo while the GLib headers are found are C:\glib.
* writer: Include documentation and symbol position in source filesThibault Saunier2018-11-288-11/+84
| | | | | | | | | | | Some documentation tool (as hotdoc[0]) need to have information about symbol declaration and documentation positions in the source files to be able to do smart indexing (automatically build the documenation index). [0] https://hotdoc.github.io/ Fixes #175
* Define grefcount and gatomicrefcount as aliases to gintTomasz Miąsko2018-11-231-0/+2
|
* giscanner: Print relative filename paths when warningJonas Ådahl2018-11-081-5/+2
| | | | | | | | | | | | | | | | g-ir-scanner would cut away the 'common prefix' between the current working directory and the file about be warned about. This is problematic when using automatic jumping to warnings and errors, as it'd mean the editor can't find the relevant file. For example, if g-ir-scanner is run from 'build/', and a warning occurs on a file in 'src/file.c', the scanner would print the warning 'src/file.c:123: Warning: This and that'. Running this from e.g. meson would mean e.g. VIM would not find the correct file to jump to. Meanwhile, GCC, in the same setup, would print '../src/file.c:123: Warning: ...', as that is the relative path from where the scanner is ran, and e.g. VIM would behave in a correct way.
* scanner: Skip ldd for library by filenameOlivier Crête2018-11-051-1/+4
|
* scanner: Accept library filenamesOlivier Crête2018-11-051-1/+2
| | | | | This makes it easier to ensure that the right library is scanned.
* scanner: Pass library paths before the -l itselfOlivier Crête2018-11-051-11/+11
| | | | | Without this, it will probably take the system library instead of the one that we are trying to test.
* scanner: Parse __typeof__ and discard itJan Alexander Steffens (heftig)2018-11-051-0/+1
| | | | | | | GLib 2.57.2 introduced __typeof__ in g_clear_pointer, which the scanner failed to parse. Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/issues/328
* flake8 updates, fixes "make check.quality"Christoph Reiter2018-11-041-1/+1
| | | | | Disables the new "W504 line break after binary operator" warning. Fixes wrong escape sequences "W605 invalid escape sequence '\.'"
* g-ir-tools: respect gir_dir_prefixKai Kang2018-10-081-0/+1
| | | | | | | | | Configure option gir_dir_prefix is used to configure install dir for .gir files, so add its value to include file search paths. Fix for flake8 and meson-test at same time. Signed-off-by: Kai Kang <kai.kang@windriver.com>
* Revert "scanner: remove hacks to make mingw g-i work with msvc Python"Chun-wei Fan2018-08-211-0/+84
| | | | | | | | Unfortunately, this is still needed for Visual Studio versions that do not have an official CPython release that uses the CRT which the compiler targets to, such as Visual Studio 2012 and 2013 This reverts commit a6a479af1bbe7c0d17766f1408c9fcb720df78dc.
* Revert "scanner: remove some unnecessary Windows includes"Chun-wei Fan2018-08-211-1/+9
| | | | | | | | | | | We need those includes and defines as we need to revert the commit that revert the hacks on Windows, as they are still necessary in the cases where we are using a Python installation that is not linked to the CRT that the currently used compiler targets to, such as on Visual Studio 2012 and 2013, where no official Python release is linked to their respective CRTs. This reverts commit e36350e3fdcb18a21089256b63298d6e3a49212b.
* docwriter: revert some output changes to make the tests passChristoph Reiter2018-08-181-3/+6
| | | | | | This reverts a small part of 19c03a46b1 to make tests pass again. The test error weren't noticed because a new Python dependency was missing, leading to those tests getting skipped.
* g-ir-doc-tool: keep mallard as the default formatChristoph Reiter2018-08-171-1/+1
| | | | | In 7f67146d8254 the FORMAT list was extended but the argparser uses the first item as default value. This broke distcheck.
* tests: depend on flake8 instead of including pep8/pyflakesChristoph Reiter2018-08-1513-19/+9
| | | | | | | | | | | | | | | | g-i includes an old version of pep8 and pyflakes and uses that during "make check". It (1) doesn't catch all cases newer versions of pycodestyle/pyflakes catch and (2) doesn't test all Python files (3) doesn't work with meson. Instead of updating just remove them and depend on flake8 instead. To run the checks simply run flake8 in the root dir. This also makes it possible to run those checks when using meson and not autotools. To not get test suite failures on flake8 updates move the checks from "make check" to an extra "make check.quality" target.