Skip to content

Remove obsolete warnings #321

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions RELEASENOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,3 +175,11 @@
- `release 6 6316`
- `release 7 7027`
- `release 6 6138`
- `note 6` Removed the obsolete warning types `WSYSTEMC` and `WDUPEVENT`. These
warnings were never reported. This change will cause errors if existing
makefiles pass e.g. `--nowarn=WSYSTEMC`.
- `note 6` Removed the obsolete warning types `WSHALL`, `WNDOC`, and
`WNSHORTDESC`. These are all disabled by default and have no known uses,
typically because enabling them produced a overwhelming noise from false
positives. This change will cause errors if exiting makefiles pass e.g.
`--warn=WSHALL`.
2 changes: 1 addition & 1 deletion messages_to_md.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def print_messages(f, warnings, errors):
## Warning Messages

The messages are listed in alphabetical order; the corresponding tags
are shown within brackets, e.g., `[WNDOC]`.
are shown within brackets, e.g., `[WNDOCRA]`.

""")

Expand Down
5 changes: 0 additions & 5 deletions py/dml/c_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -512,8 +512,6 @@ def check_attribute(node, port, prefix):
if (node.objtype in {'attribute', 'connect'}
and config_param == 'required'):
report(WNDOCRA(node, node.logname()))
elif node.objtype != 'register':
report(WNDOC(node, node.logname()))
attrname = get_attr_name(prefix, node)
register_attribute(node.site, port, attrname)
if port and need_port_proxy_attrs(port):
Expand Down Expand Up @@ -543,7 +541,6 @@ def generate_attribute_common(initcode, node, port, dimsizes, prefix,
report(WNDOCRA(node, node.logname()))
doc = "Undocumented"
else:
report(WNDOC(node, node.logname()))
doc = "Undocumented"

# append the required interfaces to the docstring
Expand Down Expand Up @@ -1954,8 +1951,6 @@ def generate_init(device, initcode, outprefix):
out('.description = '+doc.read()+',\n')
if sdoc:
out('.short_desc = '+sdoc.read()+',\n')
else:
report(WNSHORTDESC(device.site))
out('};\n', preindent = -1)
out('\n')
out('conf_class_t *class = SIM_create_class("'
Expand Down
4 changes: 1 addition & 3 deletions py/dml/ctree.py
Original file line number Diff line number Diff line change
Expand Up @@ -2033,9 +2033,7 @@ def make_simple(site, lh, rh):
etype = realtype(expr.ctype())
assert etype.is_int
ltype = realtype(lh.ctype())
if etype.bits < 1:
report(WSHALL(site, lh, rh))
elif ltype.bits > 32 and etype.bits <= 32:
if ltype.bits > 32 and etype.bits <= 32:
expr = mkCast(site, expr, etype)
return expr

Expand Down
7 changes: 0 additions & 7 deletions py/dml/dmlc.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,6 @@ def prerr(msg):
output_c = True


# Ignore some warnings by default
ignore_warning('WASSERT')
ignore_warning('WNDOC')
ignore_warning('WSHALL')
ignore_warning('WUNUSED')
ignore_warning('WNSHORTDESC')

if os.getenv('DMLC_DEBUG'):
debug_mode = True
else:
Expand Down
79 changes: 14 additions & 65 deletions py/dml/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -1893,35 +1893,11 @@ def log(self):
class WNOVER(DMLWarning):
"""
A DML file must start with a version statement, such as `dml 1.4;`
"""
fmt = "file has no version tag, assuming version 1.2"

class WSHALL(DMLWarning):
"""
The result of the shift operation will always be zero.
(This warning is disabled by default.)
"""
fmt = "shifting away all data\n%s"
def __init__(self, node, lh, rh):
DMLWarning.__init__(self, node, binary_dump(lh, rh))

class WNDOC(DMLWarning):
"""
No documentation string was specified for the attribute.
(This warning is disabled by default.)
"""
fmt = "no documentation for '%s'"
def __init__(self, node, member):
DMLWarning.__init__(self, node, member)

class WNSHORTDESC(DMLWarning):
"""
No short description string was specified using the 'desc' parameter.
(This warning is disabled by default.)
This warning becomes an error in Simics API 8 and newer, when the
compatibility feature `optional_version_statement` is disabled.
"""
fmt = "no 'desc' parameter specified for device"
def __init__(self, node):
DMLWarning.__init__(self, node)
fmt = "file has no version tag, assuming version 1.2"

class WNDOCRA(DMLWarning):
"""
Expand All @@ -1939,22 +1915,13 @@ class WNEGOFFS(DMLWarning):
"""
fmt = "negative register offset: %d"

class WUNUSED(DMLWarning):
"""
The object is not referenced anywhere.
(This warning is disabled by default.; it typically causes many false
warnings.)
"""
fmt = "unused: %s"
def __init__(self, obj):
DMLWarning.__init__(self, obj, obj.identity())

class WUNUSEDDEFAULT(DMLWarning):
"""
The object is not referenced anywhere but it matches a name of an
object automatically referenced in another scope. This is the same
as WUNUSED but only for known common errors and it will never be
emitted if WUNUSED is enabled.
In DML 1.2, it is usually a mistake to implement a method named
`after_write` in a field, because only register objects recognize that
method. The `WUNUSEDDEFAULT` warning captures this kind of mistake
by reporting a warning when a method is implemented that is unused,
but whose name matches a method commonly implemented in other objects.
"""
fmt = "unused: %s methods are not called automatically for %s objects in %s"
def __init__(self, obj):
Expand All @@ -1980,21 +1947,11 @@ class WUNUSED_DML12(DMLWarning):
def __init__(self, obj):
DMLWarning.__init__(self, obj, obj.name)

class WDUPEVENT(DMLWarning):
"""
Two or more events will be checkpointed using the same name, which
means that the checkpoint cannot be safely read back.
"""
fmt = "duplicate event checkpoint names: %s"
def __init__(self, site, objlist):
DMLWarning.__init__(self, site,
", ".join(dollar(self.site) + o.logname()
for o in objlist))

class WSIZEOFTYPE(DMLWarning):
"""
The 'sizeof' operator is used on a type name, but expects an
expression. Use the 'sizeoftype' operator for types.
In DML 1.4 it is an error to pass a type name as the operand of `sizeof`.
In DML 1.2 it instead emits a `WSIZEOFTYPE` warning, for legacy reasons.
To get the size of a type, the `sizeoftype` operator should be used.
"""
fmt = "sizeof on a type is not legal, use sizeoftype instead"

Expand Down Expand Up @@ -2028,11 +1985,6 @@ class WCONFIDENTIAL(DMLWarning):
def __init__(self, site):
DMLWarning.__init__(self, site)

# Not used (see ctree.py class CopyData), not documented.
# class WASSIGN(DMLWarning):
# def __init__(self, site):
# DMLWarning.__init__(self, site, "cannot perform assignment")

class WOLDAST(DMLWarning):
"""
A precompiled DML file has an old time-stamp. This may happen if a
Expand All @@ -2052,16 +2004,13 @@ class WWRNSTMT(DMLWarning):
"""
fmt = "%s"

class WSYSTEMC(DMLWarning):
""" SystemC specific warnings """
fmt = "%s"

# This message should be removed, SIMICS-9886
# This message should be removed, SIMICS-9886
class WREF(DMLWarning):
"""An unused parameter refers to an object that has not been declared.

This warning message will be replaced with a hard error in future
major versions of Simics.
This warning message is replaced with a hard error for modules compiled
with Simics API 6 or newer.
"""
instances = []
fmt = "unused parameter %s contains %s"
Expand Down
4 changes: 1 addition & 3 deletions py/dml/structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -463,9 +463,7 @@ def check_unused_and_warn(node):
not used. This usually applies to methods and parameters."""

if node.refcount == 0:
if not warning_is_ignored('WUNUSED'):
report(WUNUSED(node))
elif is_unused_default(node):
if is_unused_default(node):
report(WUNUSEDDEFAULT(node))
elif dml.globals.dml_version != (1, 2) and is_dml12_method(node):
report(WUNUSED_DML12(node))
Expand Down