Commit Graph

22 Commits

Author SHA1 Message Date
John Thacker 2b4f939761 lemon: Add -- support to end options, use in our lemon
Patch lemon to stop parsing options upon encountering "--".
This prevents an issue in the unlikely situation where the
source directory or a source filename has a '=' in it, or
starts with a "-".

Redo 3716933046 but only
use the -- option in our lemon, not when using system lemon.
2023-09-27 08:37:07 -04:00
João Valverde 37697f7f4e Revert "lemon: Add -- support to end options"
This reverts commit 3716933046.

Does not work currently when cross-compiling.
2023-09-27 12:28:34 +00:00
John Thacker 3716933046 lemon: Add -- support to end options
Patch lemon to stop parsing options upon encountering "--".
This prevents an issue in the unlikely situation where the
source directory or a source filename has a '=' in it, or
starts with a "-".

This has been reported to sqlite upstream.
2023-09-27 01:16:43 +00:00
João Valverde 51accf1b90 Allow using host Lemon executable
Add support for using the host system's lemon binary instead of
compiling our own. Many linux distributions include a lemon
parser generator package. Using this binary when cross-compiling
is much simpler than configuring the build to use the build host
toolchain to compile lemon.
2023-05-25 21:45:22 +00:00
João Valverde 0da67aee02 CMake: Reformat UseLemon.cmake
Replace spaces with tabs and use lower-case CMake names to
match our usual style.
2023-05-25 21:45:22 +00:00
João Valverde f2218ae5f0 Lemon: Update code and remove cruft
Remove some unused historical files.

Aggressively disable warnings to keep the lemon source
pristine and avoid the maintenance burden for lemon itself.

Lemon has its own lax policy for warnings that doesn't match our
own and they won't accept external patches to remove the
warnings, so just ignore them. Lemon is just executed to generate
code for the Wireshark build and the minor code issues it has
have no influence at runtime.

For lemon generated code we selectively disable some linting
warnings.

Remove patches for lemon and lempar, they are no longer required
with these changes to silence warnings.
2023-01-01 18:18:06 +00:00
Adrian Ratiu 49240e23b4 cmake: lemon: fix path to internal lemon tool
Wireshark fails to build when cross-compiling on Gentoo/ChromeOS
systems because the lemon command is not properly specified or
included in PATH, failing with:

/bin/sh: lemon: command not found

The relevant excerpt from build.ninja is:

COMMAND = cd ..._build/plugins/epan/mate && lemon -T.../tools/lemon/lempar.c
-d. .../plugins/epan/mate/mate_grammar.lemon

By specifying the full path to "lemon" we ensure it is
always searched and found in the correct location.
2021-08-31 19:19:05 +00:00
Peter Wu 7ce9081fdc lemon: sync with upstream (2018-09-08)
Changes:
- Drop the old basename modification that was present in the Wireshark
  version of lemon.c. Use a new option available since 2018-04-20
  ("Add the -dDIRECTORY command-line option to LEMON.")
- Redo the static analyzer warning fixes, identifying the root causes
  and adding assertions instead of hiding code with __clang_analyzer__.
- Ignore compiler warnings instead of adding config.h, _U_, extra const
  keywords, unsigned/signed changes, etc.
- Remove lemon.html, it is out-of-date and external links are available.

In order to make future updates easier, document the exact steps that
were followed to create the lemon.c and lempar.c files. Future changes
SHOULD follow the same process.

My process to reach this updated lemon version:
1. Identify previous sync. Found v2.5.2rc0-147-g653af0f6d0 ("lemon: Sync
   with latest trunk.") which seems based on sqlite commit 2b3d584ffe.
2. Check successive Wireshark patches. Identified many non-functional
   changes to silence compiler warnings and static analyzer issues.
   Found one feature (basename) that can be replaced with upstream -d.
3. Write minimal patches and document changes.

Upstream typos and coding style issues (other than trailing whitespace)
were deliberately not fixed to remain as close as possible to upstream.

Change-Id: I606f46dede86e34520f962a9e7163912392aad57
Reviewed-on: https://code.wireshark.org/review/30290
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-10-21 07:00:05 +00:00
Graham Bloice 2e23b506c7 Add checkAPI calls to CMake.
This generates a top level target, checkAPI, that is
excluded from the ALL build target, so must be run separately.

On Windows using a Visual Studio generator, call
msbuild /p:Configuration=RelWithDebInfo checkAPI.vcxproj

Change-Id: I44a57c564dcfc75499463b942436f4b920a82478
Reviewed-on: https://code.wireshark.org/review/14873
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Graham Bloice <graham.bloice@trihedral.com>
2016-05-02 12:01:24 +00:00
Alexis La Goutte 9d8b810127 Lemon: Update lemon tools
Update from SQLite trunk (19 April 2015)

Add include <config.h>

Fix warning: unused parameter 'argc' [-Wunused-parameter] (using _U_)

Fix implicit conversion loses integer precision

Fix comparison of integers of different signs: 'size_t' (aka 'unsigned long') and 'int' [-Wsign-compare]

Fix function declaration isn’t a prototype [-Wstrict-prototypes]

Fix warning: old-style function definition [-Wold-style-definition]

Fix trailing whitespace

Fix use -T for template for epan\Makefile.nmake, epan\dfilter\Makefile.nmake, plugins\mate\Makefile.nmake, plugins\tpg\Makefile.nmake and cmake/modules/UseLemon.cmake

Fix -Wmissing-prototypes Remove unused function (acttab_free)

Add basename the filename with only filename (no path...)

Fix lemon.c:3435: warning: implicit conversion shortens 64-bit value into a 32-bit value

Add "new" version of lempar.c (3 November 2009).

LEMPAR: fix trailing whitespace

LEMPAR: fix -Wunused-parameter

Change-Id: I2df7e39c9a6846de26743a981fb76aca423fe813
Reviewed-on: https://code.wireshark.org/review/6502
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-07-02 08:49:02 +00:00
Peter Wu cb0ee6447b cmake/add_lemon_files: depend on lemon and lempar
Add a dependency on the lemon binary and lempar.c files because the
output depends on these tools. This is already done for autotools and
nmake.

In addition, clean up the generated .h and .out files.

Change-Id: Ic1fa2c23949abf05e976a67d226c90293b2ce834
Reviewed-on: https://code.wireshark.org/review/9139
Reviewed-by: Evan Huus <eapache@gmail.com>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2015-06-25 18:52:20 +00:00
Pascal Quantin 7d004dc887 Revert "Lemon: Update lemon tools"
This reverts commit 5855dd8d53.

This Lemon update fails to compile on OSX and triggers asserts on other platforms

Change-Id: I12a8a2bf32db31e5a9b0cb1a67a39724e30f3e91
Reviewed-on: https://code.wireshark.org/review/6496
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2015-01-11 19:57:45 +00:00
Alexis La Goutte 5855dd8d53 Lemon: Update lemon tools
Fix warning: declaration shadows a variable in the global scope [-Wshadow]

Add include <config.h>

Fix warning: unused parameter 'argc' [-Wunused-parameter] (using _U_)

Fix implicit conversion loses integer precision

Fix comparison of integers of different signs: 'size_t' (aka 'unsigned long') and 'int' [-Wsign-compare]

Fix function declaration isn’t a prototype [-Wstrict-prototypes]

Fix warning: old-style function definition [-Wold-style-definition]

Fix trailing whitespace

Fix use -T for template for epan\Makefile.nmake, epan\dfilter\Makefile.nmake, plugins\mate\Makefile.nmake, plugins\tpg\Makefile.nmake and cmake/modules/UseLemon.cmake

Fix -Wmissing-prototypes

Remove unused function (acttab_free)

Add basename the filename with only filename (no path...)

Change-Id: Ia79f61e29f828575df61cc89134c6c553044e86d
Reviewed-on: https://code.wireshark.org/review/3976
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2015-01-11 18:56:08 +00:00
Alexis La Goutte b5ff13ab61 UseLemon (CMake): Fix indent (use space)
Change-Id: I619d64d62d2fb96ab904d5ea15e3c37aa0319540
Reviewed-on: https://code.wireshark.org/review/5982
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-12-23 07:08:10 +00:00
Alexis La Goutte 757aa33220 Continue to remove $Id$ from top of file
(Using sed : sed -i '/^\# \$Id\$/,+1 d') (start with dash)

Change-Id: Ia4b5a6c2302f6a531f6a86c1ec3a2f8205c8c2dd
Reviewed-on: https://code.wireshark.org/review/881
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-31 18:48:06 +00:00
Jörg Mayer f303dfdd05 Fix a typo (letover from autotools times) which accidentally
worked with cmake on unix but not on windows

svn path=/trunk/; revision=52384
2013-10-05 21:23:57 +00:00
Kovarththanan Rajaratnam ee95203649 Add tools/lemon/CMakeLists.txt which creates the lemon parser executable
svn path=/trunk/; revision=30461
2009-10-10 05:51:08 +00:00
Jörg Mayer eefc0ffc3d While trying to understand commit 30107, I found the following at
http://www.itk.org/Bug/view.php?id=9219

Note that CMAKE_CFG_INTDIR is no longer necessary for this purpose but
has been left for compatibility with existing projects. Instead
add_custom_command() recognizes executable target names in its COMMAND

So just use "lemon" instead of specifying the full path.

svn path=/trunk/; revision=30109
2009-09-24 04:57:41 +00:00
Stig Bjørlykke 6e59814e37 Run lemon from CMAKE_CFG_INTDIR.
svn path=/trunk/; revision=30107
2009-09-23 21:23:49 +00:00
Jörg Mayer 878d7246b8 - Add $Id: $ tags
- FindHtmlViewer.cmake: Try to add reading the name of the
  html viewer from the HTML_VIEWER environment variable (untested)

svn path=/trunk/; revision=30104
2009-09-23 19:40:25 +00:00
Jörg Mayer 9500e97cb3 - Undo the PACKAGELIST WSWIN32 stuff in CMakeLists.txt:
That's what the packages are for, so instead of creating
  WSWIN32, the stuff should probably go into the GLIB2
  package.
- libwireshark now compiles - no time to add linking with
  it until tonight


svn path=/trunk/; revision=29756
2009-09-07 07:26:43 +00:00
Jörg Mayer d26cdc30ea Beginnings of getting cmake to build stuff in epan.
It's only beginnings, so epan is commented out in
the subdirs statement.

This is more a synch to avoid duplicate work and creating
conflicting patches to the cmake stuff.

svn path=/trunk/; revision=29666
2009-09-02 16:33:01 +00:00