-
Notifications
You must be signed in to change notification settings - Fork 40
/
Copy pathCHANGES
9886 lines (6184 loc) · 366 KB
/
CHANGES
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1.13.0-dev.216 | 2025-04-25 10:05:52 -0400
* Touchup docs style section [skip CI]. (Evan Typanski, Corelight)
They mentioned a nonexistent Makefile
1.13.0-dev.214 | 2025-04-25 12:33:30 +0200
* Prevent escape of non-HILTI exception in lower-level driver functions. (Benjamin Bannier, Corelight)
While we already did some handling of non-HILTI exceptions in Spicy's
high-level drivers[^spicy-driver] (even though this would allow escape
of exceptions not deriving from `std::exception`), we did not do the
same for the lower level processing functionality in the actual driver.
This is the interface used by e.g., Zeek, and already an
`std::exception` thrown from a parser would lead to the exception
propagating into Zeek and ultimately causing a `std::terminate` there,
see e.g., [this oss-fuzz
report](https://oss-fuzz.com/testcase-detail/6088469254569984). In that
particular case a call to `std::vector::reserve` exceeding the available
memory caused raising of a `std::length_error`.
This patch extends the exception handling in the driver so all
exceptions are handled by now transforming any non-HILTI exceptions into
HILTI exceptions like expected by callers.
[^spicy-driver]: https://github.com/zeek/spicy/blob/32251850bd8808d18c5dd9306dc0d56c7ebd5d9d/spicy/toolchain/bin/spicy-driver.cc#L331-L334
1.13.0-dev.212 | 2025-04-24 08:31:03 -0400
* Limit `reserve` calls on vectors to prevent OOM. (Evan Typanski, Corelight)
1.13.0-dev.210 | 2025-04-23 15:32:56 +0200
* CI: No more Ubuntu 20.04 (Arne Welzel, Corelight)
EOL in April 2025, remove it now.
1.13.0-dev.208 | 2025-04-23 12:20:45 +0200
* Bump `justrx`. (Robin Sommer, Corelight)
1.13.0-dev.206 | 2025-04-22 17:40:06 +0200
* Reserve vectors with repeat counts. (Evan Typanski, Corelight)
This improves performance of large vectors with a known size by about
10-20% while not hurting performance of small vectors.
* Fix minor comment issues in `vector.h`. (Evan Typanski, Corelight)
1.13.0-dev.203 | 2025-04-22 17:38:22 +0200
* Prevent unneeded copy. (Benjamin Bannier, Corelight)
1.13.0-dev.201 | 2025-04-17 14:03:12 -0400
* Avoid attribute temporaries for constants. (Evan Typanski, Corelight)
* GH-2016: Fix `&size` expressions evaluating multiple times. (Evan Typanski, Corelight)
Fixes #2016
If the attribute is evaluated multiple times, some cases with side
effects may unknowingly get evaluated multiple times. This effect would
be different depending what happens - if there's a parse error, it could
even trigger an integer overflow when calculating offsets.
This solution uses a temporary and passes it around the parser builder
when it's needed. The downside is this is only applicable to `&size`,
but, luckily, that seems to be all that it currently applies to.
There are some alternative solutions, but they don't seem right. One
would be adding the temporary to the attribute, but that relies on only
retrieving that temporary if you're in the correct scope. Making the
attribute itself scope-aware seems wrong, as does removing the stored
expression when it would be out of scope.
It could also technically apply to the state, but that ended up being
more cumbersome than seemed necessary.
1.13.0-dev.198 | 2025-04-17 16:52:19 +0200
* Bump justrx to pull in CCL speed-up. (Robin Sommer, Corelight)
1.13.0-dev.196 | 2025-04-16 13:42:21 +0200
* Bump pre-commit hooks. (Benjamin Bannier, Corelight)
* Only disable clang-tidy if CMake version supports it. (Benjamin Bannier, Corelight)
1.13.0-dev.193 | 2025-04-16 10:38:34 +0200
* GH-1955: Split attributes between HILTI and Spicy. (Robin Sommer, Corelight)
A previous change had moved knowledge of Spicy attributes into the
HILTI layer. This splits that out again to separate concerns. The main
challenge is that we were using C++ enums, which could not be extended
by Spicy to add its own attributes. We now replace those enums values
with a custom helper class so that we can define constants at
multiple places.
Other than that new helper class, most of the changes are pretty
mechanical, with the main objective being that Spicy only refers to
its own attributes for anything that can appear in Spicy source code,
and uses HILTI attributes only when interacting with the HILTI layer.
1.13.0-dev.191 | 2025-04-15 10:06:29 +0200
* Drop unreachable lexer rules. (Benjamin Bannier, Corelight)
1.13.0-dev.189 | 2025-04-15 08:30:10 +0200
* Bump 3rdparty/filesystem from `076592c` to `9fda7b0` (dependabot[bot])
* Bump 3rdparty/utfcpp from `b26a5f7` to `65701fe` (dependabot[bot])
1.13.0-dev.186 | 2025-04-10 16:06:16 +0200
* Remove spurious include. (Robin Sommer, Corelight)
1.13.0-dev.184 | 2025-04-10 10:14:16 +0200
* GH-2013: Disallow illegal characters in hook IDs and a couple other places. (Robin Sommer, Corelight)
The lexer wasn't handling all cases.
* Revert "Bring back the internal `__visit` method for generated structs." (Robin Sommer, Corelight)
This reverts commit 479b2d4bfb88c3010aba21f63db4c2c04a65216a. We now
*really* don't need this anymore since Zeek has been adapted
accordingly.
* GH-2007: Fix using `&try` with `&max-size`, and potentially other cases. (Robin Sommer, Corelight)
In the generated code, a temporary was declared inside the `try { ...
}` block that we create for `&try`, but then used afterwards outside
of the block. A similar issue probably could have happened in
other situations as well.
The fix is to move more of the logic that was so far following the
`try`-block into the block. This comes with potential slight semantic
changes where in case of a parse error, before we would have executed
some post-field logic that now skip. The main example is hooks:
before, if a field with a `&try` had a hook, this would still run in
case of a parse error; now it's not running anymore—--which indeed
seems the better semantics.
* Let optimizer and dependency tracker ignore unresolved declarations. (Robin Sommer, Corelight)
This normally doesn't happen because validation catches unresolved
declarations early. However, for debugging it can be helpful to
support this when running with `--skip-validation` (e.g., to get to
the output of `--output-hilti` for debugging broken code generation).
1.13.0-dev.177 | 2025-04-09 12:33:40 +0200
* Bump 3rdparty/utf8proc from `5568eff` to `3de4596` (dependabot[bot])
1.13.0-dev.175 | 2025-04-08 14:22:30 +0200
* Make sure `scope_exit` never throws on teardown. (Benjamin Bannier, Corelight)
* Restructure fold expression for Coverity. (Benjamin Bannier, Corelight)
* Prevent unneeded copies. (Benjamin Bannier, Corelight)
1.13.0-dev.171 | 2025-04-07 11:31:12 +0200
* Add `bytes::ends_with`. (Benjamin Bannier, Corelight)
* Add `string::ends_with`. (Benjamin Bannier, Corelight)
* Add `hilti::rt::endsWith`. (Benjamin Bannier, Corelight)
1.13.0-dev.167 | 2025-04-02 14:13:29 +0200
* Fix a path in the CMake config for the recent benchmark. (Robin Sommer, Corelight)
1.13.0-dev.165 | 2025-04-02 12:37:53 +0200
* Fine-tune recent CMake 4 tweak. (Robin Sommer, Corelight)
1.13.0-dev.163 | 2025-04-02 10:28:07 +0200
* Bump pre-commit hooks. (Benjamin Bannier, Corelight)
* Always build benchmarks. (Benjamin Bannier, Corelight)
* Never build 3rdparty code with `-Werror`. (Benjamin Bannier, Corelight)
* Bump 3rdparty/benchmark to 1.9.2. (Benjamin Bannier, Corelight)
* Fix clang-tidy warnings on macos. (Benjamin Bannier, Corelight)
1.13.0-dev.157 | 2025-04-02 10:27:53 +0200
* Fix minor typos in comments and docs [skip CI]. (Evan Typanski, Corelight)
1.13.0-dev.155 | 2025-04-02 09:59:29 +0200
* Change runtime representation of tuples. (Robin Sommer, Corelight)
At runtime, we so far stored HILTI tuples simply as `std::tuple` of
the corresponding element types. However, that ignored that in HILTI
tuple elements can remain unset, which that runtime representation
could not express. This still worked so far because (a) unset elements
are rare (the main use case is the `.?` operator used inside a tuple
constructor); and (b) in the cases we needed it, we had C++-side
template code figure things out a compile time. However, the old
representation meant that a host application using introspection
through HILTI's runtime type information, could not receive/see unset
tuple elements at all.
This commit changes the runtime tuple representation to wrap all
elements into `std::optional`. So a HILTI tuple `tuple<T1, T2, T3>`
now gets turned into `std::tuple<std::optional<T1>, std::optional<T2>,
std::optional<T3>>`. While that comes with some additional overhead,
that can now fully capture all possible tuple values. The runtime type
information is adjusted accordingly as well. While that is a breaking
change, it presumably affects just Zeek as the only external user of
that API currently. A corresponding Zeek change is forthcoming.
The rest of the commit is mainly mechanical: it adapts code generator
and runtime to work with the new tuple representation.
* Provide `type_info::Value` constructor not taking a parent. (Robin Sommer, Corelight)
This leaves the internal member unset, saving an unnecessarily created
`shared_ptr`.
* Add mechanism to leave temporary codegen variables uninitialized. (Robin Sommer, Corelight)
Local variables now support a "special" init expression for
performance optimization: If the init expression is an instance of
`expression::Void`, the generated C++ code will not default-initialize
the variable. That means it's not safe to read from it before it has
been written to at least once. This avoids the overhead of the
creating the default value when it's not needed, but it disables
HILTI's safety property of forcing all runtime values to have
well-defined content at all times.
This is a work-around until we have flow-based optimization which
should be able to figure out automatically when it's safe to skip
computing the default.
* Add builder method to create an `add` expression. (Robin Sommer, Corelight)
* Remove AST node for deferred expressions. (Robin Sommer, Corelight)
This was no longer used anywhere now.
* Change FFI calling convention for `any`. (Robin Sommer, Corelight)
When translating HILTI functions to C++, we now convert any HILTI-side
arguments of type `any` into *two* C++-side arguments: the value (as
before) plus a `TypeInfo*` pointer describing the value's type.
Before, we did this manually in a few cases where we needed the type
information by adding an additional `type` parameter to the HILTI
function. Now this happens implicitly and is therefore automatically
available to all functions using `any` parameters. The advantage is
that we don't need to modify an call sites to provide type information
explicitly, in particular when they are inside generated code. The
downside is that we end up receiving that new parameter in a few cases
where we don't actually need it (though this could change in the
future if we ever started to move away from templates inside the C++
runtime).
* Add a few missing type information pieces. (Robin Sommer, Corelight)
- Add runtime type information for `Null` type.
- Generate `vector` type information for type `List` (because that's how we store lists).
- Fix type information for `result<void>`.
- dd `to_string()` support for `Nothing`.
* Make pre-defined type information objects constant. (Robin Sommer, Corelight)
* Report `ast-final` debugging output even if AST validation fails. (Robin Sommer, Corelight)
1.13.0-dev.142 | 2025-04-01 17:41:10 +0200
* Work-around CMake 4 no longer setting `CMAKE_OSX_SYSROOT` by default. (Robin Sommer, Corelight)
* Let `configure` work with CMake 4. (Robin Sommer, Corelight)
* GH-1580: Catch when functions aren't called. (Robin Sommer, Corelight)
There are only very few cases where usage of a function is permitted
without calling it.
* GH-1971: Extend unit `switch` based on look-ahead to support blocks of items. (Robin Sommer, Corelight)
1.13.0-dev.135 | 2025-03-28 09:44:11 +0100
* GH-1967: Fix inactive stack size check during module initialization. (Robin Sommer, Corelight)
* GH-1974: Add documentation on how to interpret stack traces involving fibers. (Robin Sommer, Corelight)
* GH-1964: Document use of `$$` inside `&{while,until,until-including}`. (Robin Sommer, Corelight)
* GH-1963: Document `assert-exception`. (Robin Sommer, Corelight)
* GH-1155: Document iteration over maps/set/vectors. (Robin Sommer, Corelight)
1.13.0-dev.128 | 2025-03-26 11:02:19 -0400
* Add simple parser benchmarking. (Evan Typanski, Corelight)
1.13.0-dev.126 | 2025-03-18 09:04:37 +0100
* Bring back the internal `__visit` method for generated structs. (Robin Sommer)
This reverts part of cb7336ff8d02a32fc: as it turns out, the Zeek
integration still needs `__visit`. I'd like to solve this differently
on the Zeek side, but have't quite gotten that to work yet. So
reverting this for now so that we don't block.
1.13.0-dev.124 | 2025-03-12 09:02:38 -0400
* Fix defaulted params with different return types. (Evan Typanski, Corelight)
The overload check for equivalent non-defaulted parameters was within a
check for non-equivalent return types, so it only applied if return
types differed. This fixes that to apply when return types are the same.
* Fix overload conflicts beyond with the first decl. (Evan Typanski, Corelight)
Previously it would only compare with the first declaration, but this
makes it compare with all previous declarations.
* Add reasons for rejecting invalid overloads. (Evan Typanski, Corelight)
* GH-1982: Reject equivalent functions. (Evan Typanski, Corelight)
Fixes #1982
* Reject function prototypes without `&cxxname`. (Evan Typanski, Corelight)
1.13.0-dev.118 | 2025-03-06 09:05:38 -0500
* Fix `for` loop snippet to run as-is. (Evan Typanski, Corelight)
* GH-1538: Implement compound statements (`{...}`). (Evan Typanski, Corelight)
Closes #1538
The functionality was there, just not available in the parser.
1.13.0-dev.115 | 2025-03-06 12:00:38 +0100
* GH-1981: Reject function overloads which only differ in default'd parameters. (Benjamin Bannier, Corelight)
Resolution of calls to functions who's signatures differ only in
defaulted parameters behaved non-intuitively in that when given with
less than the maximum possible number of parameters we resolved to the
overload with most parameters.
With this patch we reject such overloads where the only difference is in
defaulted parameters.
Closes #1981.
1.13.0-dev.113 | 2025-03-03 17:39:36 +0100
* GH-1983: Audit links in README. (Benjamin Bannier, Corelight)
Closes #1983.
1.13.0-dev.111 | 2025-03-03 17:15:46 +0100
* GH-1977: Disallow function redef with different return. (Evan Typanski, Corelight)
Fixes #1977
C++ doesn't allow different return types with equivalent parameters, so
Spicy should grab that and error before it gets to the C++ error.
1.13.0-dev.109 | 2025-03-03 17:13:37 +0100
* GH-1976: Fix unit `&max-size` not returning to proper loc. (Evan Typanski, Corelight)
Fixes #1976
&max-size was treated the same as &size - so it was going to the end of
the limited view rather than to the proper location based on what was
parsed.
1.13.0-dev.107 | 2025-02-21 11:05:36 +0100
* Fix possibly-incorrect custom host compile command (Evan Typanski)
The order of `ldflags` compared to the `-o` output matters - they should
be after. As-is, the documentation fails to compile, but with this
change, the command succeeds for me.
1.13.0-dev.105 | 2025-02-20 12:28:40 +0100
* Remove documentation of ``&nosub``. (Robin Sommer, Corelight)
Turns out we have never supported that in Spicy (only in HILTI). The
reasons seems to be a parsing challenge: cannot easily add attributes
to regular expression constants with our Spicy Bison parser.
* GH-1965: Add support for case-insensitive matching to regular expressions. (Robin Sommer, Corelight)
By adding an `i` flag to a regular expression pattern, it will no w be
matched case-insensitively (e.g. `/foobar/i`).
* GH-100: Switch regular expressions to new justrx API. (Robin Sommer, Corelight)
justrx no longer parses group match IDs out of the expression string,
but instead now offers an API to set them directly. This switches over
to using that new API.
As a result, setting a match ID inline inside a regexp doesn't work
anymore. An example of old syntax was: `/foobar${#100}/`. Instead, we
now allow IDs to be provided after the final slash. The new syntax is
`/foobar/$(100)`. While this is technically a breaking change, I doubt
anybody has been using this, and I don't think it's worth putting any
backwards-compatibility in.
Admittedly, that new ID syntax is bit arbitrary, and mostly chosen so
that it can be parsed easily. But it's not something users will
commonly use, so that seems fine. The Bison parser for that new syntax
already prepares for more pattern flags as well that we will want to
support.
* Bump justrx to pull in new API group matching. (Robin Sommer, Corelight)
* Refactor regexp patterns. (Robin Sommer, Corelight)
So far we were storing the regexp patterns as strings directly inside
the `RegExp` class. This factors out that storage into a new `Pattern`
helper class. Right now, that helper class likewise only stores a
string, just as before. But will extend that soon.
1.13.0-dev.99 | 2025-02-18 11:43:18 +0100
* Add a `to_string()` callback to our custom runtime type information. (Robin Sommer, Corelight)
Now a host application can render a value into a string that it has
retrieved through the runtime introspection API. The
`type_info::Value` class gains a `to_string()` method as the
user-facing entry point to that.
* Provide generated, C++-side structs and unions with explicit `__to_string` methods. (Robin Sommer, Corelight)
This replaces the `__visit` methods we had so far, which we only used
for implementing the free-standing ``to_string()`` overloads for structs and units.
This is primarily cleanup, simplifying our generated code by avoiding
the hard-to-read `__visit` indirection, and maybe also speeding up
compilation times a bit because we no longer need any templates.
We also rename the `__str__` method (used for implementing the `on
%print` hook) to `__hook_to_string` for consistency.
Note that external C++ code should continue to call the free-standing
`to_string()` function to render a struct/unit, not the new method,
because the method doesn't take the `on %print` hook into account.
* Move runtime function `lookupParser()` into global space. (Robin Sommer, Corelight)
This used to be a method of the Spicy `Driver` class, but isn't really
tied to it, and useful on its own as well. Moving it to global scope,
but keeping the existing method for backwards compatibility.
* Make `type` a type. (Robin Sommer, Corelight)
This is primarily for making it easier to pass type information to
host applications. It contains the following:
- In HILTI & Spicy, allow to declare variables to have type
`type`. These variables then store type information objects.
Initialization can come from either `typeinfo(TYPE)` (which
already existed in HILTI, but not Spicy), or coercion from an
existing type ID (e.g., `global T: type = MyStruct);` (which is
new in both HILTI and Spicy). Note that coercion from a basic
type does not work because of limitations of our Bison parser
(it can't parse, e.g., `t = bool`).
The effect of `type` was already achievable by declaring
variables to be of type
`__library_type("hilti::rt::TypeInfo*")`, but that was quite
hackish/internal.
- Add an attribute to `type::Library` that records whether the
underlying C++ type is always `const`, and needs to be declared
as such. We need this for `hilti::rt::TypeInfo`, which is always
constant. So far we had just added that `const` to C++-side type
itself, but that (1) was just a hack, and (2) could cause
trouble if the name was used in places where that `const`
confused the C++ compiler.
To be able to declare a `const` library type from inside
HILTI/Spicy, we add a new keyword `__library_type_const`.
- Include the C++ name of the library type into it's runtime type
information.
- Add `print` support for type information, printing the type's
`display` name.
* Do not include CXX flags into linker flags. (Robin Sommer, Corelight)
Unnecessary, and may confuse the linker.
* Map C++ types corresponding to public structs into public namespace in generated C++ prototypes. (Robin Sommer, Corelight)
* Fix generated C++ prototype header. (Robin Sommer, Corelight)
1.13.0-dev.91 | 2025-02-18 11:42:52 +0100
* Remove `TryCoercionWithinSameType` from all shortcut coercion styles. (Robin Sommer, Corelight)
Seems it wasn't needed anywhere there actually, mostly because it
combination with `TryCoercion` it wasn't adding anything.
* Compose a coercion bit. (Benjamin Bannier, Corelight)
* Reuse previously declared coercion bits for readability. (Benjamin Bannier, Corelight)
* Remove unused conversion bit. (Benjamin Bannier, Corelight)
* GH-1968: Fix coercion of function call arguments. (Robin Sommer, Corelight)
Before, we could unnecessarily coerce integer types when a direct
match was available. The fix takes out the `TryCoercionWithinSameType`
style for non-coercing function call arguments, which solves it. I
don't recall why that was in there in the first place, but it doesn't
seem to break anything to skip it ...
1.13.0-dev.85 | 2025-02-18 10:04:22 +0100
* Fix possessive "it's" in contexts docs. (Evan Typanski, Corelight)
* GH-1966: Reject anonymous units in variables and fields. (Evan Typanski, Corelight)
* Avoid creating external types unnecessarily during AST construction. (Robin Sommer, Corelight)
We could end up creating external types for freshly created AST nodes
just because we wanted them to have a certain constness/sideness. This
could then lead to the original types not being validated because they
weren't inserted into the AST anywhere.
This also extends the AST dump output for qualified types to indicate
whether it's an internal or external type.
1.13.0-dev.81 | 2025-02-07 09:21:54 +0100
* Drop freebsd-13 from default CI jobs. (Benjamin Bannier, Corelight)
* Bump pre-commit hooks. (Benjamin Bannier, Corelight)
* Bump freebsd-14 in CI. (Benjamin Bannier, Corelight)
* Bump freebsd-13 in CI. (Benjamin Bannier, Corelight)
* Bump opensuse-15 in CI. (Benjamin Bannier, Corelight)
1.13.0-dev.75 | 2025-01-23 10:29:10 +0100
* Regenerate usage documentation. (Benjamin Bannier, Corelight)
* Clean up minor warts in usage strings of some executables. (Benjamin Bannier, Corelight)
* Add `spicy-dump` option to enable profiling. (Benjamin Bannier, Corelight)
1.13.0-dev.71 | 2025-01-14 17:26:02 +0100
* Prevent unneeded copy in setting up unit `parseX` functions. (Benjamin Bannier, Corelight)
* Used fixed initialization for order for global static. (Benjamin Bannier, Corelight)
The `HILTI_PRE_INIT` macros work on the global
`_registered_preinit_functions` container. Since uses of the macro and
the global container are likely in different translation units their
initialization order can be undetermined (even though we have some
manual checks whether the `unique_ptr<vector>>` is null).
This patch cleans up initialization of the global so it should always be
fully initialized when accessed.
1.13.0-dev.68 | 2025-01-13 22:54:50 +0100
* GH-1958: Prevent copies in various places. (Benjamin Bannier, Corelight)
This adds a change incorrectly dropped from #1958.
1.13.0-dev.66 | 2025-01-13 22:09:19 +0100
* Prevent copies in various places. (Benjamin Bannier, Corelight)
1.13.0-dev.64 | 2025-01-10 09:55:22 +0100
* Address a FIXME. (Benjamin Bannier, Corelight)
* Prevent exception in generic `noexcept` function. (Benjamin Bannier, Corelight)
* Avoid theoretical exception in widely used helper function. (Benjamin Bannier, Corelight)
* Prevent destructor from throwing. (Benjamin Bannier, Corelight)
* Avoid throwing never handled exception in low-level helper function. (Benjamin Bannier, Corelight)
* Prevent exception escape. (Benjamin Bannier, Corelight)
* Drop dereference of end iterator. (Benjamin Bannier, Corelight)
* Prevent potential nullptr dereference. (Benjamin Bannier, Corelight)
* Prevent copies in various places. (Benjamin Bannier, Corelight)
This patch removes copies in different places by e.g., leveraging const
lifetime expansion or move semantics. We also clean up getters to return
new values less often.
* Prevent division by zero which is UB. (Benjamin Bannier, Corelight)
* Clearly mark up unreachable code. (Benjamin Bannier, Corelight)
* Add missing `break` in `switch` case. (Benjamin Bannier, Corelight)
* Drop redundant string copy. (Benjamin Bannier, Corelight)
* Remove copyright end year in source files [skip CI]. (Benjamin Bannier, Corelight)
* Remove copyright years [skip CI]. (Evan Typanski, Corelight)
1.13.0-dev.47 | 2025-01-08 17:48:23 +0100
* Fix update Fedora links in installation docs. (Benjamin Bannier, Corelight)
1.13.0-dev.45 | 2025-01-08 17:15:06 +0100
* GH-1936: Migrate `Attribute::Kind` to enum stringification framework. (Benjamin Bannier, Corelight)
This patch performs cleans up the recently added `Attribute::Kind` enum
so it is properly integrated.
- introduce a standalone enum `attribute::Kind` outside of the
`Attribute` class
- use enum helpers for conversion from and to string
Closes #1936.
1.13.0-dev.43 | 2025-01-08 09:39:45 +0100
* Drop unused includes. (Benjamin Bannier, Corelight)
* Move temporaries instead of creating copies. (Benjamin Bannier, Corelight)
* Avoid copies in implementation of trivial getters. (Benjamin Bannier, Corelight)
* Avoid copy when constructing node properties. (Benjamin Bannier, Corelight)
* Bump pre-commit hooks. (Benjamin Bannier, Corelight)
* Always initialize enum member to reasonable default. (Benjamin Bannier, Corelight)
* Always initialize pointer members. (Benjamin Bannier, Corelight)
* Fix use-after-move. (Benjamin Bannier, Corelight)
1.13.0-dev.34 | 2025-01-08 09:39:11 +0100
* Bump `3rdparty/filesystem` to pick up fixes for clang-tidy-19. (Benjamin Bannier, Corelight)
* Drop unused clang-format integration in `./ci/run-ci`. (Benjamin Bannier, Corelight)
This was already unused since we moved clang-format to a pre-commit
hook.
* Move `./ci/run-ci`'s clang-tidy check to CMake. (Benjamin Bannier, Corelight)
Instead of implementing this ourself instea use CMake with
`CMAKE_CXX_CLANG_TIDY`/`CMAKE_C_CLANG_TIDY`.
* Update CMake version in CI for clang-tidy. (Benjamin Bannier, Corelight)
* Bump LLVM toolchain used in CI. (Benjamin Bannier, Corelight)
* Fix up APIs in AST API which were not actually moving. (Benjamin Bannier, Corelight)
Many functions in the AST API were moving arguments only for them to
ultimately be copied; `clang-tidy` diagnosed most of these.
This patch cleans up the flagged useless passes by value and `std::move`
without effect.
* Fix up container helpers to ensure moving. (Benjamin Bannier, Corelight)
It is not immediately clear to me when the previous implementation could
move their values over. `clang-tidy` ended up flagging many of these as
not moving and forcing copies.
This patch rewrites the loops in these helpers to enforce iteration with
move.
* Disable clang-tidy on generated lexer/parser files. (Benjamin Bannier, Corelight)
* Reformat code not recognized as C++ by pre-commit hook. (Benjamin Bannier, Corelight)
* Remove some unneeded includes. (Benjamin Bannier, Corelight)
* Parenthesize expression when arithmetic mixes difference precedences. (Benjamin Bannier, Corelight)
`clang-tidy` suggests adding extra parentheses when mixing e.g.,
addition and multiplication. Apply these suggestions (automatically).
* Consistently pass `std::string_view` by value. (Benjamin Bannier, Corelight)
`std::string_view` is a type which is designed to be (very) cheap to
copy.
* Remove unneeded copies. (Benjamin Bannier, Corelight)
* Fix APIs taking `std::string_view` assuming them to be null-terminated. (Benjamin Bannier, Corelight)
In general `std::string_view` values do not need to be null-terminated,
e.g., if they reference subranges in a bigger null-terminated string. We
were previously passing `std::string_view` in a few places where we
assumed them to be null-terminated, e.g., for passing them on to C APIs
expecting null-terminated `const char*`. These worked well enough for us
for now, but these APIs were generally unsafe.
This patch switches to instead passing either `const char*` signalling
proper, null-terminated strings, or by passing in a `const std::string&`
where it should already be present in the caller.
* Consistently mark functions and values not exposed `static`. (Benjamin Bannier, Corelight)
* Locally suppress `clang-tidy` diagnostic. (Benjamin Bannier, Corelight)
This suppresses a `clang-tidy` lint suggesting to mark our default
`main` function as not exported. This function is shipped as part of
libhilti and intended to be available as a weak symbol.
* Prefer `std::max` over ad hoc implementations. (Benjamin Bannier, Corelight)
* Fix APIs where we assumed a string_view was null-terminated. (Benjamin Bannier, Corelight)
This either switches to using `const char*` to signify guaranteed null
termination, or locally suppress clang-tidy warnings about assuming
null-terminated string_views.
* Bring configuration for `clang-tidy` up-to-date. (Benjamin Bannier, Corelight)
This patch brings our clang-tidy setup up to date. Much of this was
built with `./ci/run-ci` `in mind with extra suppressions hardcoded
e.g., in `.clang-tidy.ignore`. With this patch we instead configure
`.clang-tidy` files so they can suppress diagnostics from certain
directories. We also set up 3rdparty code to work with CMake's
`clang-tidy` integration[1].
We also globally suppress some diagnostics which we have no intention of
addressing.
[^1]: https://cmake.org/cmake/help/latest/prop_tgt/LANG_CLANG_TIDY.html#prop_tgt:%3CLANG%3E_CLANG_TIDY
1.13.0-dev.14 | 2025-01-06 16:29:53 +0100
* Do not require owning strings for `startsWith`. (Benjamin Bannier, Corelight)
By passing in a `const std::string&` we would have incurred construction
costs of an owning string when all we needed was a non-owning view.
We also clean up the implementation of `startsWith` to use standard
library functionality.
* Move implementation of `Bytes::[lower|upper]` to cc file. (Benjamin Bannier, Corelight)
* GH-1788: Implement decoding and encoding UTF16 `Bytes`. (Benjamin Bannier, Corelight)
This adds two new charsets `UTF16LE` and `UTF16BE` for little and big
endian UTF16 respectively.
We also clean up use of the Unicode replacement character to make it
work consistently between UTF16 and UTF8.
Closes #1788.
* Add utfcpp submodule. (Benjamin Bannier, Corelight)
* Remove unneeded explicit conversion to HILTI enum in test. (Benjamin Bannier, Corelight)
* Add optional `errors` parameter to `strings::encode`. (Benjamin Bannier, Corelight)
This parameter defaults to `DecodeErrorStrategy::REPLACE` like the
previous implicit parameter used in the implementation.
* Move `Bytes` encoding into `string`. (Benjamin Bannier, Corelight)
This allows a cleaner separation between `Bytes` as "bags of bytes" and
`string` as "valid UTF8". Having such a clean separation will make
adding support for more encodings less duplicative.
* Use unified `DecodeErrorStrategy` for both `bytes` and `string`. (Benjamin Bannier, Corelight)
This was already exposed as a single type in Spicy and HILTI anyway. We
also move `Charset` into the `unicode` namespace.
* Update for spicy-1.12.0 release. (Benjamin Bannier, Corelight)
* Keep test `spicy.rt.time` working for the next 200 years. (Benjamin Bannier, Corelight)
This test still compares the current time against hardcoded times to
check ordering. Extend the upper value so this test passes for the next
~200 years.
1.13.0-dev.2 | 2024-12-19 17:08:09 +0100
* GH-1949: Fix codegen for string literals containing null bytes. (Benjamin Bannier, Corelight)
Our strings are UTF8 which can contain literal null bytes. We were
previously generating incorrect C++ for such literals. This was due to
us constructing C++ value via constructors taking `const char*` which is
expected to be null-terminated, i.e., everything after the terminator
was ignored even though it was emitted.
With this patch we switch to C++ literals for generating literal and
runtime strings.
Closes #1949.
1.13.0-dev.0 | 2024-12-13 09:26:36 +0100
* GH-1901: Add consistent validation for attributes. (Evan Typanski, Corelight)
This updates attribute validation to see if attributes are in the
right places. The goal here is to have one place (ie a big set) to
answer the question "Can I use X attribute on Y node?"
There are a lot more moving parts with attribute validation, but those
generally have to do with behavior. A lot of that requires extra context
in the validator, which is exactly what the validator is meant to do.
Much of that is pretty ad-hoc, so it could get cleaned up as well.
1.12.0-dev.240 | 2024-12-12 13:09:05 +0100
* Make sure autogen-docs pre-commit hook can always run in CI. (Benjamin Bannier, Corelight)
1.12.0-dev.238 | 2024-12-10 14:53:29 +0100
* Update tutorial to use spicy-driver's batch mode. (Robin Sommer, Corelight)
* Allow defining parser alias names when running spicy-driver. (Robin Sommer, Corelight)
``--parser-alias <alias>=<name>`` now makes the parser of name
`<name>` accessible under an additional name `<alias>`. The option can
be used multiple times.
This is particularly useful when using input batches: by adding an
alias of the form `PORT/PROTOCOL` (e.g., `--parser-alias
80/tcp=MyHTTP::Message`), this allows to define a parser to use on for
connections on that port (because the batch processing interprets any
ports in the trace as strings and tries to lookup a parser of the
corresponding name). Adding `%orig` or `%resp` to the alias name
limits it to the corresponding direction (e.g., ``--parser-alias
80/tcp%orig=MyHTTP::Request``).
See the `spicy-driver` documentation for more details on how to use
this with batches.
* Let `spicy-{dump,driver}` print out parser alias names with ``-ll``. (Robin Sommer, Corelight)
``-list-parsers`` prints the direct names of all known parsers.
However, internally, we sometimes register additional alias names that
can also be used to lookup a parser (e.g., if there's a `%mime-type`
or `%port` property). If one specifies ``-list-parsers`` twice now,
those aliases are printed as well.
* GH-1829: Catch integer shifts exceeding the width of the operand. (Robin Sommer, Corelight)
For constants, we now reject such shifts at compile time. At runtime,
we catch them by having the forked version of `SafeInt` throw an
overflow exception.
* Change `SafeInt` submodule to a fork including a fix. (Robin Sommer, Corelight)
We now use a fork of `SafeInt` that includes
https://github.com/dcleblanc/SafeInt/pull/64 (as well as general bump
to upstream `master`).
* Add `max-lines` option to Sphinx' `spicy-output` directive. (Robin Sommer, Corelight)
This limits the lines of output shown to the given number, adding a
`...` marker if truncated.
* GH-1928: Deprecate `&anchor` with regular expression constructors. (Robin Sommer, Corelight)
* Update auto-generated architecture diagram. (Robin Sommer, Corelight)
Looks like some dependency upgrade changed the content slightly.
1.12.0-dev.226 | 2024-12-09 17:28:27 +0100
* Fix `HILTI_CXX_FLAGS` for when multiple flags are passed. (Benjamin Bannier, Corelight)
* Add helper function to perform shell-like string splitting. (Benjamin Bannier, Corelight)
1.12.0-dev.223 | 2024-12-09 11:54:03 +0100
* Fix ruff 'ISC' lints. (Benjamin Bannier, Corelight)
* Fix ruff 'I' lints. (Benjamin Bannier, Corelight)
* Fix ruff 'C4' lints. (Benjamin Bannier, Corelight)
* Migrate Python linting to ruff. (Benjamin Bannier, Corelight)
* Bump pre-commit hooks. (Benjamin Bannier, Corelight)
* Upgrade Python to 3.9 with pyupgrade. (Benjamin Bannier, Corelight)
1.12.0-dev.216 | 2024-12-06 10:34:31 +0100
* Introduce `deprecated` helper function in Spicy validator. (Benjamin Bannier, Corelight)
* Add test for using both `[]` and `&count`. (Benjamin Bannier, Corelight)
* GH-1938: Deprecate `&count` attribute. (Benjamin Bannier, Corelight)
The preferred way to indicate how many elements should be parsed for a
vector has been vector syntax over `&count` for a long time, e.g.,
```
type X = unit {
: uint8[] &count=42; # AVOID.
: uint8[42]; # PREFER.
};
```
With this patch `&count` is now deprecated and we emit a warning. We
will remove support for `&count` in a future release.
Closes #1938.
1.12.0-dev.212 | 2024-12-05 10:31:19 +0100
* Fix doc code snippet that won't compile. (Evan Typanski, Corelight)
1.12.0-dev.210 | 2024-12-04 12:08:31 +0100
* Fix issue with type inference for `result` constructor. (Robin Sommer, Corelight)
`global x = result("foo");` would end up having type `string` instead
of `result<string>`.
* GH-1856: Disallow dereferencing a `result<void>` value. (Robin Sommer, Corelight)
Closes #1856.
* GH-1856: Teach `&requires` to accept condition-tests expressions. (Robin Sommer, Corelight)
This now allows creating custom error messages when a `&require`
condition fails. Example:
type Foo = unit {
x: uint8 &requires=($$ == 1 : error"Deep trouble!'");
# or, shorter:
y: uint8 &requires=($$ == 1 : "Deep trouble!'");
};
Internally, `&requires` now always wants a condition-test expression.
That remains transparent to the user, however, because the resolver
knows how to coerce a pure boolean `&requires` expression into a
condition test, crafting an error message that happens to look like
what we used to produce in the past.
Closes #1856.
* Teach `assert` to accept an `result<void>` value. (Robin Sommer, Corelight)
This allows to use the new condition-test operator with assert:
assert 3 == 4 : error"not equal"
Because of the RHS of a condition test coercing a `string` to `error`
automatically, this now also covers the existing syntax for `assert`.
So the above is now (externally and internally) the same as:
assert 3 == 4 : "not equal"
* Add new "condition-test" operator. (Robin Sommer, Corelight)
This adds a new expression operator to both HILTI and Spicy:
`COND : ERROR`
where `COND` is a boolean expression, and `ERROR` is an expression of
type `error`. When evaluated, the new operator yields a value of type
`result<void>`, which will be true if the `COND` is true, and set to
`ERROR` if `COND` is false. In other words, this is a short-cut to
both test a condition and provide an error message in case it fails.
1.12.0-dev.204 | 2024-11-28 13:57:57 +0100
* Spell all `Attribute::Kind` values in Pascal case. (Benjamin Bannier, Corelight)