Commit graph

184 commits

Author SHA1 Message Date
Vern Paxson
08fbc7efb3 helper scripts for -O C++ maintenance 2022-05-12 14:09:35 -07:00
Vern Paxson
56140046d3 final changes for -O C++ feature completeness, mainly "when" statement support 2022-05-12 14:07:36 -07:00
Vern Paxson
bcebe27ced updates for compile-to-C++ 2022-03-23 15:36:36 -07:00
Matthew Luckie
11f8729997 remove deprecated union and timer types, addressing #1898 2022-02-19 19:17:51 +13:00
Tim Wojtulewicz
3d9d6e953b Merge remote-tracking branch 'origin/topic/vern/when-lambda'
* origin/topic/vern/when-lambda:
  explicitly provide the frame for evaluating a "when" timeout expression
  attempt to make "when" btest deterministic
  tests for new "when" semantics/errors
  update existing test suite usage of "when" statements to include captures
  update uses of "when" in base scripts to include captures
  captures for "when" statements update Triggers to IntrusivePtr's and simpler AST traversal introduce IDSet type, migrate associated "ID*" types to "const ID*"
  logic (other than in profiling) for assignments that yield separate values
  option for internal use to mark a function type as allowing non-expression returns
  removed some now-obsolete profiling functionality
  minor commenting clarifications
2022-01-14 14:41:42 -07:00
Tim Wojtulewicz
2accf6dfbf Merge remote-tracking branch 'origin/topic/vern/CPP-type-switch'
* origin/topic/vern/CPP-type-switch:
  support for compiling type-based switches to C++
  make encountering uncompilable "standalone" functions to be a hard error
  fix: ZAM could misinterpret a "type" switch that starts with a "default"
  fix: don't treat pseudo-identifiers in type cases as local variables
  removed development helper scripts now obsolete with --optimize-files=
2022-01-11 15:02:52 -07:00
Vern Paxson
f895008c34 captures for "when" statements
update Triggers to IntrusivePtr's and simpler AST traversal
introduce IDSet type, migrate associated "ID*" types to "const ID*"
2022-01-07 14:50:35 -08:00
Vern Paxson
fa142438fe logic (other than in profiling) for assignments that yield separate values 2022-01-07 14:18:42 -08:00
Tim Wojtulewicz
edf90a51e4 GH-1624: Migrate check_and_promote and a few Expr methods to IntrusivePtr 2022-01-07 12:33:54 -07:00
Vern Paxson
721d99636e support for compiling type-based switches to C++ 2021-12-23 11:39:58 -08:00
Vern Paxson
c6cd5d7a3b make encountering uncompilable "standalone" functions to be a hard error 2021-12-23 11:38:09 -08:00
Vern Paxson
adb4958c73 removed development helper scripts now obsolete with --optimize-files= 2021-12-23 11:36:35 -08:00
Vern Paxson
3fc58bdd9f minor note regarding improving performance of C++-generated code 2021-12-12 12:42:16 -08:00
Vern Paxson
86288426fb factoring of generating C++ initializations, no semantic changes 2021-12-12 12:41:16 -08:00
Vern Paxson
2f7137999f restored support for incremental compilation of scripts to C++ 2021-12-12 12:36:45 -08:00
Vern Paxson
3b3cea799b fixes for -O gen-standalone-C++ 2021-12-12 12:36:08 -08:00
Vern Paxson
96ed944571 fix for compiling record constructors to C++ 2021-12-12 12:34:23 -08:00
Vern Paxson
52ed9351a9 fixes for compiling vector operations to C++ 2021-12-12 12:33:38 -08:00
Vern Paxson
ce7f886077 removing vestigial methods 2021-12-12 12:32:27 -08:00
Vern Paxson
9069e744f9 replace --optimize-only with --optimize-funcs and --optimize-files 2021-12-10 12:45:27 -08:00
Tim Wojtulewicz
aa91f72b34 Merge remote-tracking branch 'origin/topic/vern/cpp-add-option2'
* origin/topic/vern/cpp-add-option2:
  reintroduction of "-O add-C++" option
2021-12-10 13:13:26 -07:00
Tim Wojtulewicz
56b421db9f Merge remote-tracking branch 'origin/topic/vern/cpp-maint-dec21'
* origin/topic/vern/cpp-maint-dec21:
  fixes for vector operations
  flag globals initialized to opaque values as non-compilable
  skip type signatures for lambdas
  fix for translating filenames beginning with numbers to C++ variable names
  remove unnecessary includes
2021-12-10 13:12:58 -07:00
Vern Paxson
8c59626eb9 reintroduction of "-O add-C++" option 2021-12-10 10:19:23 -08:00
Vern Paxson
ac74943f26 fixes for vector operations 2021-12-10 09:32:42 -08:00
Vern Paxson
6788be94c9 flag globals initialized to opaque values as non-compilable 2021-12-10 09:31:41 -08:00
Vern Paxson
53342fdd29 skip type signatures for lambdas 2021-12-10 09:27:58 -08:00
Vern Paxson
474a2edc98 fix for translating filenames beginning with numbers to C++ variable names 2021-12-10 09:27:21 -08:00
Vern Paxson
9d884c0285 remove unnecessary includes 2021-12-10 09:27:07 -08:00
Vern Paxson
a1324a882d update script-to-C++ compilation for new record constructor internals 2021-12-06 09:39:58 -05:00
Tim Wojtulewicz
e7412e257f Merge remote-tracking branch 'bbannier/topic/bbannier/more-autoformating'
* bbannier/topic/bbannier/more-autoformating:
  Format Python scripts with yapf.
  Format shell scripts with shfmt.
2021-12-01 10:33:22 -07:00
Tim Wojtulewicz
6a7bbd5268 Merge remote-tracking branch 'origin/topic/vern/CPP-cond'
* origin/topic/vern/CPP-cond:
  fix btest comment to more accurately describe the test
  clang-format issue
  btests for erroneous script conditionals
  avoid compiling-to-C++ for functions potentially influenced by conditionals
  track the use of conditionals in functions and files
  AST profiles track the associated function/body/expression
2021-12-01 10:25:58 -07:00
Vern Paxson
46f46e7803 clang-format issue 2021-11-29 13:17:46 -08:00
Vern Paxson
a4b9218771 avoid compiling-to-C++ for functions potentially influenced by conditionals 2021-11-24 15:19:21 -08:00
Benjamin Bannier
1f388e3f40 Format shell scripts with shfmt.
All changes in this patch were performed automatically with `shfmt` with
configuration flags specified in `.pre-commit-config.yaml`.

In addition to fixing whitespace the roundtrip through shfmt's AST also
transforms command substitutions

    `cmd`
    # becomes
    $(cmd)

and some redirects

    >&2 echo "msg"
    # becomes
    echo >&2 "msg"
2021-11-24 23:13:02 +01:00
Vern Paxson
a2cec7463f suppress unneeded initializations 2021-11-24 12:17:16 -08:00
Tim Wojtulewicz
e0b4659488 Merge remote-tracking branch 'origin/topic/vern/CPP-speedup'
* origin/topic/vern/CPP-speedup:
  use iterator-based idiom for check-if-present-then-access
  const-ify member function
  switch looping over vectors to use iterators
  remove unused local variables
  efficiency fix - return a reference rather than a copy of a map
  fix for case-sensitive file systems
  geez sometimes it's signed sometimes it's not
  documentation updates
  remove -O add-C++ and -O update-C++ options
  extensive rewrite of generation & execution of run-time initialization
  factoring out CPPEscape to be a standalone function
  removing unused SubNetType class
2021-11-23 19:44:57 -07:00
Vern Paxson
84423369b4 use iterator-based idiom for check-if-present-then-access 2021-11-22 15:28:15 -08:00
Vern Paxson
735d584d9f const-ify member function 2021-11-22 10:55:38 -08:00
Vern Paxson
ffbbacd3b1 switch looping over vectors to use iterators 2021-11-18 08:58:04 -08:00
Vern Paxson
6f82c1610e remove unused local variables 2021-11-18 08:57:03 -08:00
Vern Paxson
8e77e3e92c efficiency fix - return a reference rather than a copy of a map 2021-11-18 08:56:24 -08:00
Benjamin Bannier
4e16037acd Format code with clang-format
This patch formats files not conforming to the C++ formatting with
`clang-format`.
2021-11-09 07:20:18 +01:00
Vern Paxson
55b2ce7dbc Merge branch 'topic/vern/CPP-speedup' of github.com:zeek/zeek into topic/vern/CPP-speedup 2021-11-07 17:56:26 -08:00
Vern Paxson
3ea362be91 fix for case-sensitive file systems 2021-11-07 17:54:56 -08:00
Vern Paxson
0bdc268a00 geez sometimes it's signed sometimes it's not 2021-11-07 17:49:30 -08:00
Vern Paxson
ab1a29184c documentation updates 2021-11-07 17:05:21 -08:00
Vern Paxson
e1a760e674 extensive rewrite of generation & execution of run-time initialization 2021-11-07 17:00:19 -08:00
Vern Paxson
bc3bf4ea6c factoring out CPPEscape to be a standalone function 2021-11-07 16:57:52 -08:00
Tim Wojtulewicz
64748edab1 Replace most uses of typedef with using for type aliasing 2021-10-11 14:51:10 -07:00
Tim Wojtulewicz
9af6b2f48d clang-format: Set penalty for breaking after assignment operator 2021-09-27 10:49:48 -07:00