Commit Graph

204 Commits

Author SHA1 Message Date
Cary R f03033e612 Update flex destroy routines to work for version 2.6 and greater 2017-11-16 19:11:50 -08:00
Martin Whitaker c0845d8bea Fix assertion failure when using -Wmacro-redefinition, -y, and -D.
Predefined macros get stored in the precompiled macro file that gets
read back in when processing library files. This means the predefined
macros get processed twice. We need to skip the check in this case.
2017-11-08 20:07:38 +00:00
Martin Whitaker 02daffc97e Add option to only warn about macro redefinitions that change the text.
A common use case (prior to the introduction of localparam) was to
use macros to define constant values, and to put global constant
values in an include file that gets included by each source file.
This will generate a lot of spurious warnings if we warn about all
redefinitions. Make this new option the default for -Wall.
2017-11-08 19:50:42 +00:00
Martin Whitaker af1ea13c47 Don't check for macro redefinition if the warning is disabled.
And reword the comment to be a bit less dictatorial.
2017-11-06 21:03:03 +00:00
Andrew Andrianov 9e2252bc39 ivlpp: Actually take warn_redef flag into account
Signed-off-by: Andrew Andrianov <andrew@ncrmnt.org>
2017-10-22 13:28:15 +03:00
Andrew Andrianov 0c84413347 ivlpp: Add -Wredef option to enable redefinition warnings
Signed-off-by: Andrew Andrianov <andrew@ncrmnt.org>
2017-10-18 19:18:14 +03:00
Andrew Andrianov 73167563d5 ivlpp: Warn about macro redefinition
Verilog spec has a very nasty system of macros jumping from
file to file, resulting in a global macro scope. We abosolutely
MUST track macro redefinitions and warn user about them.

Signed-off-by: Andrew Andrianov <andrew@ncrmnt.org>
2017-10-08 14:22:40 +03:00
Martin Whitaker 332170d36b Fix for GitHub issue #105 - fully support SV macro escape sequences.
The existing support for ``, `", and `\`" did not work in nested macro
definitions. Note that the new implementation only detects and replaces
these sequences inside the macro text (as required by the IEEE standard),
whereas the old implementation would detect and replace them anywhere in
the source files.
2016-06-06 20:12:04 +01:00
Martin Whitaker 9f4b485c1c Updated copyright dates displayed for main programs and targets. 2015-08-17 22:05:08 +01:00
Martin Whitaker 586e415d96 Allow macro arguments to be omitted when default values are available.
SystemVerilog allows fewer actual arguments than formal arguments when
all remaining formal arguments have default values.
2015-06-27 19:02:02 +01:00
Larry Doolittle b23faff27c Just a few more spelling fixes
Includes some user-visible messages
2015-06-17 08:09:34 -07:00
Larry Doolittle 33c651aa00 Spelling fixes in .txt files 2015-05-25 12:52:03 -07:00
Martin Whitaker d5b41853fd Fix for br979 part 2 - handle blank lines in macro definition continuation. 2015-05-22 18:44:25 +01:00
Martin Whitaker 0fc10e3e70 Fix for br979 part 1 - strip leading/trailing space from macro actual args.
Although the IEEE standard doesn't explicitly state this is required,
the examples added in the SystemVerilog standard show that this is
expected.

Also add a preprocessor lexical rule to recognise `` inside a macro
definition when it is not immediately followed by an identifier.
2015-05-22 18:11:24 +01:00
Martin Whitaker a479bd6b16 Fix for br977 - preprocessor macros substitute text inside token.
When replacing macro formal parameters, the preprocessor should not
replace matching strings that are not complete tokens. The test for
this was incorrect, and failed when a match was found at the start
of the replacement text.
2015-05-17 20:05:45 +01:00
Martin Whitaker cfbc90812b Enable use of MinGW ANSI stdio routines.
Defining __USE_MINGW_ANSI_STDIO=1 provides C99 compatible printf
and scanf routines, which avoids the need for workarounds for the
various failings of the Microsoft C runtime library.
2015-05-10 11:45:42 +01:00
Martin Whitaker 6a3edc63d5 Fix printf format for size_t values when using 64-bit MinGW.
The Microsoft C runtime does not support the %zu and %zd formats.
Previously these were replaced with %u and %d, but for 64-bit we
need to use %llu and %lld.
2015-05-08 20:20:14 +01:00
Cary R 43841af2f3 Fix a cppcheck warning and fix code style a bit 2014-12-11 09:59:15 -08:00
Stephen Williams 3e9c14060f lexor handles arbitrary length defines in the precompiled_defiles file. 2014-10-25 09:48:11 -07:00
Cary R d6b6b76015 Update header files to use a more standard name to prevent rereading
This is from github report #16. There are likely a few more issues
that need to be addressed though this takes care of the major ones.
2014-07-23 13:42:56 -07:00
Cary R 9d99a64bf0 Remove warnings and -Wno-type-limits option since it is not always supported. 2014-07-09 11:04:43 -07:00
Larry Doolittle e221a8ced9 Rearrange compiler warning flags
Before this patch, WARNING_FLAGS applied to both C and C++,
and WARNING_FLAGS_CXX applied to C++ only.
This patch adds a WARNING_FLAGS_CC that applies to C only.
That change should be generally useful; in particular the C
code is almost ready for -Wstrict-prototypes, which does not
apply to C++.

-Wextra (or -W) used to only apply to C++ via WARNING_FLAGS_CXX.
This patch moves it to WARNING_FLAGS, to apply to both C and C++.
Unfortunately, that triggers a ton of warnings.

For now, cover most of the new warnings up by adding
-Wno-unused -Wno-sign-compare -Wno-type-limits
to WARNING_FLAGS_CC.  In the long run, I want to change the C coding
style, and take off these disable-warning flags.  But those changes
can dribble in as separate commits; this patch is big enough already.

Actually fix a couple missing-field-initializers in libveriuser/veriusertfs.c.
2014-07-09 09:04:17 -07:00
Larry Doolittle 6ebb57195b Fuss with C function prototypes
119 formal void parameters added to keep -Wstrict-prototypes happy.
Process found one real missing prototype in vpi/vcd_priv.h:
EXTERN void vcd_names_delete(struct vcd_names_list_s*tab);
8 such warnings left, all in Tony's code
2014-07-08 13:44:11 -07:00
Larry Doolittle 642acb4082 Clean up some more sign-compare issues
The only known problems left are in files imported from gtkwave,
if not for them you could turn on -Wsign-compare.

Assumes c99 for c code, so the scope of for-loop indexes can be made sane.
2014-06-17 12:57:26 -07:00
Stephen Williams aced587461 Macros with formal arguments can have default text for those arguments. 2013-12-07 12:20:28 -08:00
Cary R d5823b3e55 update a copyright and fix the define order. 2013-10-07 16:51:48 -07:00
Jared Casper ec8081f983 Handle `", `\`", and `` in macro definitions.
Implements page 644 of IEEE 1800-2012.

`` is now overloaded with the Icarus-specific "stringify" expansions.
It is now used as indicated in 1800-2012 when appearing inside a macro
definition, and the Icarus way when not.  To do so, it uses the fact
that istack->file is NULL iff we are processing expanded macro text,
which is a bit of hack but works as is.

`" and `\`" on the other hand are treated the same inside and outside
of macro definitions.
2013-10-07 16:16:00 -07:00
Arun Persaud f5aafc32f9 updated FSF-address 2012-08-29 10:12:10 -07:00
Cary R ea420d94ac Fix for pr3539372.
This patch matches what was proposed in pr3539372 to fix ivlpp to correctly
handle an escapped \ at the end of a string.
2012-07-09 11:42:28 -07:00
Cary R fc7e7640ed Remove some MinGW32-w64 compile warnings. 2012-01-05 17:26:08 -08:00
Cary R 9c99bce054 Update lex/yacc builds to be consistent and to support parallel builds
Not all the lex/yacc (flex/bison) targets were using a consistent syntax.
This patch fixes that and explicitly serializes the *.c/*.cc and *.h build.
Not doing this was causing problem when using make -j. The issue appears to
be that if two targets are specified for a rule (e.g. file.cc file.h: file.y)
make does not realize they are both built by the same call so the rule is
executed twice. Once for the .cc target and once for the .h target. This is
not a problem for a serial build. To work around this only use the .c/.cc
file in the main target and then make the .h file depend on the .c/.cc file
as a sub-target.
2012-01-04 18:21:40 -08:00
Cary R a433fa3fcd Update the Makefiles to use more override able values.
Update the various Makefiles to use override able constants.
2012-01-02 10:27:38 -08:00
Martin Whitaker 58d182bdf3 Compiler fixes for MinGW.
In MinGW, when parameters are passed to vhdlpp by ivlpp, single quotes
are treated as ordinary characters. Use double quotes instead, as is
done in the driver.

Also, MinGW does not have a standard mkdir() function, so we need to
convert calls to mkdir() into calls to _mkdir().
2011-11-03 19:11:28 -07:00
Cary R e22c692656 Fix a memory leak in ivlpp.
The new VHDL strings need to be freed to make valgrind happy.
2011-10-14 17:53:49 -07:00
Stephen Williams 13ecb67717 Add support for vhdl named libraries.
Put libraries in a directory of libraries, support a search path
of library directories, and read those libraries as needed.
2011-07-30 18:18:03 -07:00
Stephen Williams 521005caf6 Add +vhdl-work+ control to the config file.
Presumably, the user will want the ability to explicitly set the
working library location, so create a +vhdl-work+ plusarg setting
for exactly that purpose.
2011-07-24 15:24:32 -07:00
Greg Steuck f186c81403 Moved lex prefixes from Makefile.in into the corresponding .lex files.
Added an explicit option prefix="yy" to files that were generated
without an explicit -P.

This makes the lex-generated symbol names self contained without any
help from from build system.
2011-05-07 11:38:32 -07:00
Cary R 2b95e9b463 Forward port the LEX/YACC definition changes from V0.9
It's best to use the LEX and YACC definitions instead of hard coding
flex/bison so they can be overridden if needed.
2011-04-13 18:46:57 -07:00
Larry Doolittle 8a568055f6 Spelling fixes
All are in comments and .txt files except for one in the Architecture::Statement dump message.
2011-03-29 08:56:10 -07:00
Stephen Williams 05122d3e2c Add VHDLPP support to ivlpp program
The ivlpp program is a good place to detect that the source file
is VHDL, and pass the source file to the vhdlpp program. Do so
automatically.
2011-01-18 17:03:51 -08:00
Joe Auricchio fd5bc3fe51 ivlpp: Add __FILE__ magic macro
I can't believe that forward declaration trick works, to make both
left and up links statically between def_LINE and def_FILE.
2010-12-02 16:26:12 -08:00
Joe Auricchio 1f1b7d36bc ivlpp: Add __LINE__ magic macro 2010-12-02 16:26:05 -08:00
Joe Auricchio 63fd0813bd ivlpp: Macros with `__ are checked for magicalness 2010-12-02 16:25:56 -08:00
Joe Auricchio 8cf66adbc0 ivlpp: foundation for 'magic' macros, eg `__LINE__ 2010-12-02 16:25:45 -08:00
Cary R a4a7b0a09d Make ivl_alloc.h the last include so it doesn't effect any system includes.
In ivl_alloc.h we redefine malloc(), realloc() and calloc() to have
standard error checking. We don't want to do this for anything that
comes from the standard headers. This specifically doesn't work if
a C++ header files does std::malloc, etc.

Also change to -W instead of -Wextra since that is more portable. I
plan to add a check from -Wextra and use it when available since it
is more descriptive.
2010-11-02 10:51:57 -07:00
Cary R be44214598 Add cppcheck target to the Makefile
This patch adds support for running cppcheck from the Makefile. It also
standardizes the order of some of the targets. It renames vpip_format.c
to vpip_format.cc and fixes the size of the array tables to make room
for the trailing NULL. Found when using a C++ compiler.
2010-10-14 19:11:32 -07:00
Cary R cb86fb15bf Add error checking definitions for malloc(), realloc() and calloc()
This patch adds defines that translate all malloc(), realloc() and calloc()
calls into ones with error checking when ivl_alloc.h is included.
2010-10-14 17:39:23 -07:00
Stephen Williams ec49f10e2d Revert bad merge from vhdl branch 2010-10-02 11:02:27 -07:00
Stephen Williams c4c7a619ea Merge branch 'vhdl' 2010-10-01 15:13:29 -07:00
Larry Doolittle 6388430661 Down payment on const-correctness
Clears out the unambiguous and easy-to-fix const faults,
so we can focus better on the fundamental ones.
2010-09-29 17:15:40 -07:00