Fix some new compiler warnings seen when using GCC 15 and clang 21.

No functional changes.
This commit is contained in:
Martin Whitaker 2025-10-12 22:23:24 +01:00
parent 4372560290
commit 9c62154924
6 changed files with 19 additions and 17 deletions

View File

@ -1,7 +1,7 @@
/*
* VHDL abstract syntax elements.
*
* Copyright (C) 2008-2021 Nick Gasson (nick@nickg.me.uk)
* Copyright (C) 2008-2025 Nick Gasson (nick@nickg.me.uk)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -127,10 +127,7 @@ void* vhdl_element::operator new(size_t size)
// to NULL (since it's safe to delete a NULL pointer).
void vhdl_element::operator delete(void* ptr)
{
// Let the default delete handle the deallocation
::operator delete(ptr);
// Remember that we've already deleted this pointer so we don't
// Remember that we've deleted this pointer so we don't
// delete it again in the call to free_all_objects
vector<vhdl_element*>::iterator it =
find(allocated_.begin(), allocated_.end(), static_cast<vhdl_element*>(ptr));
@ -144,6 +141,9 @@ void vhdl_element::operator delete(void* ptr)
cerr << "??? vhdl_element::operator delete called on an object not "
<< "allocated by vhdl_element::operator new" << endl;
}
// Let the default delete handle the deallocation
::operator delete(ptr);
}
// Return the total number of bytes our custom operator new has seen.

View File

@ -1,6 +1,6 @@
const char COPYRIGHT[] =
"Copyright (c) 2011-2024 Stephen Williams (steve@icarus.com)\n"
"Copyright (c) 2011-2025 Stephen Williams (steve@icarus.com)\n"
"Copyright CERN 2012 / Stephen Williams (steve@icarus.com)";
/*
* This source code is free software; you can redistribute it
@ -22,8 +22,6 @@ const char COPYRIGHT[] =
# include "version_base.h"
# include "version_tag.h"
using namespace std;
/*
* Usage: vhdlpp [flags] sourcefile...
* Flags:
@ -100,6 +98,8 @@ const char NOTICE[] =
# define mkdir(path, mode) mkdir(path)
#endif
using namespace std;
bool verbose_flag = false;
// Where to dump design entities

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011 Stephen Williams (steve@icarus.com)
* Copyright (c) 2011-2025 Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
@ -23,6 +23,7 @@
# include <map>
# include <typeinfo>
# include <cassert>
# include <cstdlib>
# include <algorithm>
using namespace std;
@ -217,7 +218,7 @@ int VTypeArray::get_width(ScopeBase*scope) const
if(!dim.lsb()->evaluate(scope, lsb_val))
return -1;
size *= 1 + labs(msb_val - lsb_val);
size *= 1 + abs(msb_val - lsb_val);
}
return element_type()->get_width(scope) * size;

View File

@ -270,7 +270,7 @@ static PLI_INT32 atohex_calltf(ICARUS_VPI_CONST PLI_BYTE8*name)
*/
static void value_to_text_base(char*text, long val, long base)
{
static const char digit_map[16] = "0123456789abcdef";
static const char digit_map[16] __attribute__ ((nonstring)) = "0123456789abcdef";
char* ptr;
assert(base <= 16);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2021 Stephen Williams (steve@icarus.com)
* Copyright (c) 2011-2025 Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
@ -20,6 +20,7 @@
# include "vpi_config.h"
# include "vpi_user.h"
# include <assert.h>
# include <stdint.h>
# include "ivl_alloc.h"
# include "sys_priv.h"
@ -93,7 +94,7 @@ static PLI_INT32 monitor_events(struct t_cb_data*cb)
static PLI_INT32 ivlh_attribute_event_compiletf(ICARUS_VPI_CONST PLI_BYTE8*data)
{
event_type_t type = (event_type_t) data;
event_type_t type = (event_type_t)(uintptr_t)data;
vpiHandle sys = vpi_handle(vpiSysTfCall, 0);
vpiHandle argv = vpi_iterate(vpiArgument, sys);
vpiHandle arg;
@ -153,7 +154,7 @@ static PLI_INT32 ivlh_attribute_event_compiletf(ICARUS_VPI_CONST PLI_BYTE8*data)
static PLI_INT32 ivlh_attribute_event_calltf(ICARUS_VPI_CONST PLI_BYTE8*data)
{
event_type_t type = (event_type_t) data;
event_type_t type = (event_type_t)(uintptr_t)data;
vpiHandle sys = vpi_handle(vpiSysTfCall, 0);
struct t_vpi_value rval;
struct monitor_data*mon;
@ -198,7 +199,7 @@ static PLI_INT32 ivlh_attribute_event_sizetf(ICARUS_VPI_CONST PLI_BYTE8*type)
static PLI_INT32 ivlh_shift_calltf(ICARUS_VPI_CONST PLI_BYTE8*data)
{
shift_type_t shift_type = (shift_type_t) data;
shift_type_t shift_type = (shift_type_t)(uintptr_t)data;
vpiHandle callh = vpi_handle(vpiSysTfCall, 0);
vpiHandle argv = vpi_iterate(vpiArgument, callh);
vpiHandle argh = vpi_scan(argv);

View File

@ -428,13 +428,13 @@ extern PLI_UINT32 vpi_mcd_open(char *name);
extern PLI_UINT32 vpi_mcd_close(PLI_UINT32 mcd);
extern char *vpi_mcd_name(PLI_UINT32 mcd);
extern PLI_INT32 vpi_mcd_printf(PLI_UINT32 mcd, const char*fmt, ...)
#ifdef __MINGW32__
#if defined(__MINGW32__) && !defined(__clang__)
__attribute__((format (gnu_printf,2,3)));
#else
__attribute__((format (printf,2,3)));
#endif
extern PLI_INT32 vpi_printf(const char*fmt, ...)
#ifdef __MINGW32__
#if defined(__MINGW32__) && !defined(__clang__)
__attribute__((format (gnu_printf,1,2)));
#else
__attribute__((format (printf,1,2)));