mirror of
https://github.com/verilator/verilator.git
synced 2025-01-01 04:07:34 +00:00
Fix MinGW compiler error, bug927.
This commit is contained in:
parent
6c5884853f
commit
95ac0e61b2
2
Changes
2
Changes
@ -5,7 +5,7 @@ indicates the contributor was also the author of the fix; Thanks!
|
||||
|
||||
* Verilator 3.875 devel
|
||||
|
||||
**** Fix MinGW compiler error, bug929. [Hans Tichelaar]
|
||||
**** Fix MinGW compiler error, bug927, bug929. [Hans Tichelaar]
|
||||
|
||||
**** Fix .c files to be treated as .cpp, bug930. [Jonathon Donaldson]
|
||||
|
||||
|
@ -920,10 +920,10 @@ void vpi_get_value(vpiHandle object, p_vpi_value value_p) {
|
||||
value_p->value.str = outStr;
|
||||
switch (vop->varp()->vltype()) {
|
||||
// outStrSz does not include NULL termination so add one
|
||||
case VLVT_UINT8 : snprintf(outStr, outStrSz+1, "%hhu", (unsigned char )*((CData*)(vop->varDatap()))); return;
|
||||
case VLVT_UINT16: snprintf(outStr, outStrSz+1, "%hu", (unsigned short)*((SData*)(vop->varDatap()))); return;
|
||||
case VLVT_UINT32: snprintf(outStr, outStrSz+1, "%u", (unsigned int )*((IData*)(vop->varDatap()))); return;
|
||||
case VLVT_UINT64: snprintf(outStr, outStrSz+1, "%llu", (unsigned long long)*((QData*)(vop->varDatap()))); return;
|
||||
case VLVT_UINT8 : VL_SNPRINTF(outStr, outStrSz+1, "%hhu", (unsigned char )*((CData*)(vop->varDatap()))); return;
|
||||
case VLVT_UINT16: VL_SNPRINTF(outStr, outStrSz+1, "%hu", (unsigned short)*((SData*)(vop->varDatap()))); return;
|
||||
case VLVT_UINT32: VL_SNPRINTF(outStr, outStrSz+1, "%u", (unsigned int )*((IData*)(vop->varDatap()))); return;
|
||||
case VLVT_UINT64: VL_SNPRINTF(outStr, outStrSz+1, "%llu", (unsigned long long)*((QData*)(vop->varDatap()))); return;
|
||||
default:
|
||||
strcpy(outStr, "-1");
|
||||
_VL_VPI_ERROR(__FILE__, __LINE__, "%s: Unsupported format (%s) for %s, maximum limit is 64 bits",
|
||||
|
@ -207,7 +207,8 @@ typedef unsigned long long vluint64_t; ///< 64-bit unsigned type
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
#if defined(_WIN32) && defined(_MSC_VER)
|
||||
# define VL_SNPRINTF _snprintf
|
||||
# define VL_VSNPRINTF vl_vsnprintf
|
||||
inline int vl_vsnprintf(char* str, size_t size, const char* format, va_list ap) {
|
||||
int count = -1;
|
||||
@ -220,6 +221,7 @@ inline int vl_vsnprintf(char* str, size_t size, const char* format, va_list ap)
|
||||
return count;
|
||||
}
|
||||
#else
|
||||
# define VL_SNPRINTF snprintf
|
||||
# define VL_VSNPRINTF vsnprintf
|
||||
#endif
|
||||
|
||||
|
@ -14,6 +14,7 @@
|
||||
//*************************************************************************
|
||||
|
||||
#include "vpi_user.h"
|
||||
#include <sstream>
|
||||
|
||||
class TestSimulator {
|
||||
private:
|
||||
@ -69,9 +70,11 @@ public:
|
||||
}
|
||||
// return absolute scope of obj
|
||||
static const char* rooted(const char *obj) {
|
||||
static char buf[256];
|
||||
snprintf(buf, sizeof(buf), "%s.%s", top(), obj);
|
||||
return buf;
|
||||
static string buf;
|
||||
ostringstream os;
|
||||
os<<top()<<"."<<obj;
|
||||
buf = os.str();
|
||||
return buf.c_str();
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -88,14 +88,15 @@ sub cstr {
|
||||
}
|
||||
|
||||
sub vsnprintf {
|
||||
my $files = "src/*.c* src/*.h include/*.c* include/*.h test_c/*.c* test_regress/t/*.c* test_regress/t/*.h";
|
||||
my $cmd = "cd $root && grep -n -P 'vsnprintf' $files | sort";
|
||||
# Note do not do test_regress, as VPI files need to compile without verilatedos.h
|
||||
my $files = "src/*.c* src/*.h include/*.c* include/*.h test_c/*.c*";
|
||||
my $cmd = "cd $root && grep -n -P '(snprintf|vsnprintf)' $files | sort";
|
||||
print "C $cmd\n";
|
||||
my $grep = `$cmd`;
|
||||
my %names;
|
||||
foreach my $line (split /\n/, $grep) {
|
||||
if ($line =~ /\b(vsnprintf)\b/) {
|
||||
next if $line =~ /# *define\s*VL_VSNPRINTF/;
|
||||
if ($line =~ /\b(snprintf|vsnprintf)\b/) {
|
||||
next if $line =~ /# *define\s*VL_V?SNPRINTF/;
|
||||
print "$line\n";
|
||||
$names{$1} = 1;
|
||||
}
|
||||
|
@ -26,11 +26,11 @@ double sc_time_stamp() {
|
||||
const char* trace_name() {
|
||||
static char name[1000];
|
||||
#if defined(T_TRACE_CAT)
|
||||
snprintf(name,1000,"obj_dir/t_trace_cat/simpart_%04d.vcd", (int)main_time);
|
||||
VL_SNPRINTF(name,1000,"obj_dir/t_trace_cat/simpart_%04d.vcd", (int)main_time);
|
||||
#elif defined(T_TRACE_CAT_REOPEN)
|
||||
snprintf(name,1000,"obj_dir/t_trace_cat_reopen/simpart_%04d.vcd", (int)main_time);
|
||||
VL_SNPRINTF(name,1000,"obj_dir/t_trace_cat_reopen/simpart_%04d.vcd", (int)main_time);
|
||||
#elif defined(T_TRACE_CAT_RENEW)
|
||||
snprintf(name,1000,"obj_dir/t_trace_cat_renew/simpart_%04d.vcd", (int)main_time);
|
||||
VL_SNPRINTF(name,1000,"obj_dir/t_trace_cat_renew/simpart_%04d.vcd", (int)main_time);
|
||||
#else
|
||||
# error "Unknown test"
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user