26 Commits
Author SHA1 Message Date
Viacheslav KoryaginandOpenAI Codex f7424439fd THRIFT-6445: Add ability to mark enums as flags
Client: py,netstd

Co-Authored-By: OpenAI Codex (GPT-6) <noreply@openai.com>
2026-10-24 15:30:21 +02:00
Jens GeyerandClaude Opus 5 7b6ce7e222 THRIFT-6108: Omit the empty first line of netstd exception-only docs
Client: netstd

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-26 21:46:20 +02:00
Viacheslav Koryagin 40ff4f631e THRIFT-6108: implemented exception documentation generation
Client: cpp,haxe,java,javame,kotlin,netstd,py
2026-09-26 21:46:20 +02:00
Jens GeyerandClaude Opus 5 15d81751bd THRIFT-6062: Give each Smalltalk struct its own read and write methods
Client: st

The Smalltalk generator expanded nested struct serialization textually:
generating the code for a struct-typed field emitted that struct's whole
reader and writer inline, at every use. There was no base case and no
visited set, so a type that contained itself expanded for ever and the
generator recursed until its own stack ran out. "thrift --gen st" on a
recursive IDL died with SIGSEGV - on test/Recursive.thrift, on the
minimal self-recursive struct in the issue, and on mutually recursive
types.

Each generated struct class now carries its own serialization:
"writeTo: oprot" on the instance side and "readFrom: iprot" on the class
side. A struct-typed field compiles to a call to those rather than to a
copy of their bodies, so the generator visits each struct once and the
recursion is gone.

The bodies are the same code as before: struct_writer and struct_reader
are unchanged except that they are emitted once per struct instead of at
every use. The args and result structs a service synthesises are still
inlined into the send and recv methods, because they have no class to
hang a method on - and they no longer expand without bound, because the
expansion now stops at the first declared struct.

This also makes the depth limit from THRIFT-6052 mean something. Inlined,
the incrementRecursionDepth pairs counted lexical nesting, which is fixed
when the code is generated; now each struct counts one level per actual
call, so the limit applies to how deep the data is. Verified in Pharo on
a self-recursive type: depth 64 accepted, depth 65 rejected with
"Maximum recursion depth exceeded". That could not be tested before,
because a recursive type could not be generated at all.

Two things the restructure forced:

write_val emitted "iprot write..." for base types and enums while every
other part of the write path emitted "oprot". It worked only because
TClient>>inProtocol: defaults oprot to the same object, and would write
field values to the wrong protocol for anyone calling outProtocol:.
Inside "writeTo: oprot" there is no iprot at all, so these now say oprot.

read_val's struct case returns a keyword message rather than a block, so
it is parenthesised: "coll add: Foo readFrom: iprot" would otherwise
parse as a single add:readFrom: send.

Verification, all in Pharo against the generated code:
  - a self-recursive type generates, files in, and round-trips a
    five-deep value unchanged;
  - the existing suites still pass on code from the new generator
    (recursion depth 6 of 6, string size limit 11 of 11);
  - for a non-recursive nested struct the bytes on the wire are
    identical to those the old generator produced.

The regression guard is a compiler test, st_recursive_types, which runs
thrift --gen st over test/Recursive.thrift. It carries no
PASS_REGULAR_EXPRESSION on purpose: it passes only on a zero exit, and a
signal is not one. It fails with SEGFAULT before this change.

Generated Smalltalk changes shape for everyone: struct classes gain two
methods and service methods get shorter.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-21 13:41:16 +02:00
Jens GeyerandClaude Sonnet 4.6 43e699045d THRIFT-5864: Remove Swift binding
Client: swift

Remove the Swift compiler generator, library, tests, tutorial, and all
associated build system, CI, and documentation references. No maintainer
has been available for this binding; the lib-swift CI job has been
disabled since 0.23.0.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-18 22:32:58 +02:00
Jens GeyerandClaude Sonnet 4.6 a2eb3905c8 THRIFT-6038: Markdown generator: default .md extension and @param/@return table
Client: compiler

Two improvements to the Markdown code generator:

1. Output files now use the .md extension by default (previously no
   extension was appended). The existing 'suffix' option now also
   accepts an empty value (suffix=) to explicitly suppress the extension.
   This is a visible behaviour change for callers relying on the old
   no-extension default.

2. @param and @return tags in function doc-comments are rendered as a
   Markdown table instead of inline prose. Tags are only recognised at
   the start of a line (after optional whitespace), so @-signs embedded
   in ordinary text (email addresses, etc.) are left untouched.
   Multi-line tag descriptions (continuation lines before the next tag)
   are joined into a single table cell. '|' characters in cell content
   are escaped as '\|' to protect table structure.

Adds a test fixture (DocTest.thrift), a golden reference file
(DocTest.md), a Python unittest script (markdown_doc_test.py), and a
corresponding CMake test target (MarkdownDocTest).

Applied clang-format to the entire file (pre-existing style issues
corrected alongside the new code).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-25 22:58:11 +02:00
Carel Combrink 3adca0ecfe Missed actually using the new variables from the new calls to get Python 2025-11-20 00:01:57 +01:00
Carel Combrink 23e29d67f4 FIx cmake warning on CMP0148
- find_package(PythonInterp) and find_package(PythonLibs) were deprecated in 3.12 and removed in 3.27
- The project minimum is at 3.16 already
2025-11-20 00:01:57 +01:00
Alexandre Detiste d078721e44 remove more Python2 compatibility 2025-01-15 22:27:26 +01:00
Thomas 63f04583e3 Manually remove $(BUILT_SOURCES) since no-dist-built-sources doesnt work 2024-04-02 14:09:27 +02:00
Jens Geyer ec0141cc55 * THRIFT-4655 Parser fails on the word "from"
Client: Compiler (general)
Patch: Jens Geyer

This also fixes an unhandled "normalize" case with enums in netstd that came up during tests for this ticket.

This closes #2715
2022-10-16 11:41:33 +02:00
Jiayu Liu 97323f3deb fix staleness check in cmake/ctest (#2661) 2022-09-13 21:25:25 +08:00
Jens Geyer 944b8e68a0 fixed a ton of missing ASF headers in *.thrift files 2022-09-11 12:31:26 +02:00
Jano Svitok 4fd001c878 THRIFT-5138 Swift keywords may be used as identifiers if escaped
Client: Swift
Patch: Jano Svitok

This closes #2059
2020-05-20 00:48:35 +02:00
Mario Emmenlauer 5ef8e3ec2a Remove boost from compiler test, delete unused bincat.sh 2020-04-24 15:34:02 +01:00
Qinghui Xu 6701dbb8e8 THRIFT-4976: Delay 1 second before recompiling
Patch: Qinghui Xu

This closes #1898

In some environment, the file system only has second accuracy on
file modification timestamp, so delay of 0.1 second before
recompiling could makes the modification timestamp unchanged.
2019-10-19 21:03:08 +02:00
Kevin Wojniak a392566e9b THRIFT-4896 - prevent cpp and c_glib include directories from leaking into other targets (#1821)
- enable the automake `nostdinc` option
- fix up include paths
2019-07-01 14:07:45 -04:00
James E. King III 29f7f8f32f THRIFT-4743: remove cpp compiler plugin support to simplify the project 2019-01-26 23:53:38 -05:00
James E. King III 278528cf7b THRIFT-4732: windows cmake refinements and add windows docker build support 2019-01-11 20:47:00 -05:00
James E. King III c9ac8d2953 THRIFT-4720: documenting breaking changes, minor cleanup 2019-01-09 17:05:34 -05:00
nsrtvwls 014f53f658 THRIFT-4496: python specific list of keywords for python generator (#1567)
Client: py
2018-09-28 11:11:21 -04:00
Mustafa Senol Cosar 09c1f3719c THRIFT-4532: Do not update previously generated output files if the contents have not changed 2018-05-01 07:53:52 -04:00
Roman Soroka e58f75daa8 THRIFT-4513: Fix thrift compiler to generate constants in stable order.
This closes #1505
2018-03-14 13:07:10 -04:00
Chet Murthy 6ae4023052 THRIFT-4393: renumber GeneratorInput t_{type,etc...}_id
Client: compiler

This closes #1419
2018-01-10 23:45:56 -05:00
dtmuller 052abc39c6 THRIFT-2835 Add possibility to distribute generators separately from thrift core, and load them dynamically
Deploy headers needed to build plugins

Restructure source tree to match lib and to make sure headers are
deployed to INCLUDE_DIR/thrift.

This closes #368 and closes #1039
2016-09-26 01:42:02 +09:00
Nobuaki Sukegawa 11da87e6f3 THRIFT-2835 Add possibility to distribute generators separately from thrift core, and load them dynamically
Client: Compiler
Patch: Nobuaki Sukegawa, rebased by dtmuller

Also fixed by dtmuller:
* Add plugin namespace for erlang language binding
* Fix unit test test_const_value
* Don't clear type cache with every t_program conversion
* Type "wb" may not be supported by popen on non-Windows platforms
* Fix constness of AST type signatures
2016-09-26 01:42:01 +09:00