The NetBSD Project

CVS log for src/usr.bin/xlint/lint1/Attic/ops.def

[BACK] Up to [cvs.NetBSD.org] / src / usr.bin / xlint / lint1

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.32, Thu Sep 14 21:08:12 2023 UTC (7 months ago) by rillig
Branch: MAIN
CVS Tags: HEAD
Changes since 1.31: +1 -1 lines
FILE REMOVED

lint: remove preprocessor magic from definition of operators

No binary change.

Revision 1.31 / (download) - annotate - [select for diffs], Wed Sep 13 20:31:58 2023 UTC (7 months ago) by rillig
Branch: MAIN
Changes since 1.30: +95 -94 lines
Diff to previous 1.30 (colored) to selected 1.27 (colored)

lint: prevent invalid memory access when checking an expression

In check_expr_misc, the left and right operands of an expression were
accessed even in the case of CON (constant), STRING (string literal) and
NAME (identifier), which led to invalid values in pointer variables.
These invalid values were not used though, but technically they invoked
undefined behavior.

Precede each access to the operands with a check that the expression
indeed has operands, except in those cases where the operand is known to
have operands by only looking at the code of the current function.

Revision 1.30 / (download) - annotate - [select for diffs], Sat Jun 3 20:58:00 2023 UTC (10 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.29: +6 -1 lines
Diff to previous 1.29 (colored) to selected 1.27 (colored)

lint: loosen assertion that unary operators have only a single operand

Revision 1.29 / (download) - annotate - [select for diffs], Wed Jun 15 18:44:41 2022 UTC (22 months ago) by rillig
Branch: MAIN
CVS Tags: netbsd-10-base, netbsd-10-0-RELEASE, netbsd-10-0-RC6, netbsd-10-0-RC5, netbsd-10-0-RC4, netbsd-10-0-RC3, netbsd-10-0-RC2, netbsd-10-0-RC1, netbsd-10
Changes since 1.28: +9 -9 lines
Diff to previous 1.28 (colored) to selected 1.27 (colored)

lint: update comments in operator table

No binary change.

Revision 1.28 / (download) - annotate - [select for diffs], Sat Apr 16 22:21:10 2022 UTC (2 years ago) by rillig
Branch: MAIN
Changes since 1.27: +13 -13 lines
Diff to previous 1.27 (colored)

lint: merge mod_t.m_test_context into m_requires_bool

These two flags mean exactly the same.

No functional change.

Revision 1.27 / (download) - annotate - [selected], Sat Apr 16 21:22:12 2022 UTC (2 years ago) by rillig
Branch: MAIN
Changes since 1.26: +71 -71 lines
Diff to previous 1.26 (colored)

lint: clean up table with operator properties

Now that lint may use C99, make use of empty macro arguments.

No binary change.

Revision 1.26 / (download) - annotate - [select for diffs], Sat Apr 16 21:14:33 2022 UTC (2 years ago) by rillig
Branch: MAIN
Changes since 1.25: +3 -3 lines
Diff to previous 1.25 (colored) to selected 1.27 (colored)

lint: rename members of tnode_t to more closely match reality

The flags do not describe the left operand of the node but both, as for
most operators, either none or both operands are in test context or in
value context.

The one exception is the operator '?' from the '?:' conditional, for
which the left operand is in test context and the right operand is in
value context.

No binary change.

Revision 1.25 / (download) - annotate - [select for diffs], Fri Sep 10 20:02:50 2021 UTC (2 years, 7 months ago) by rillig
Branch: MAIN
Changes since 1.24: +2 -2 lines
Diff to previous 1.24 (colored) to selected 1.27 (colored)

lint: replace space followed by tab with simply tab

No functional change.

Revision 1.24 / (download) - annotate - [select for diffs], Sat Aug 14 12:46:23 2021 UTC (2 years, 8 months ago) by rillig
Branch: MAIN
Changes since 1.23: +2 -2 lines
Diff to previous 1.23 (colored) to selected 1.27 (colored)

lint: allow initialization of struct with constant member

The operator INIT, just like RETURN and FARG, initializes an object with
an expression.  The target object of such an initialization may be a
struct with constant members.

The operator ASSIGN, on the other hand, is entirely different.  It
overwrites the existing value of the object, and this is not allowed for
structs that have a constant member.  Therefore it was wrong to use the
operator ASSIGN for initialization.

Revision 1.23 / (download) - annotate - [select for diffs], Tue Aug 10 16:59:28 2021 UTC (2 years, 8 months ago) by rillig
Branch: MAIN
Changes since 1.22: +10 -10 lines
Diff to previous 1.22 (colored) to selected 1.27 (colored)

lint: fix documentation of FARG and PUSH

Revision 1.22 / (download) - annotate - [select for diffs], Tue Aug 10 07:02:00 2021 UTC (2 years, 8 months ago) by rillig
Branch: MAIN
Changes since 1.21: +11 -1 lines
Diff to previous 1.21 (colored) to selected 1.27 (colored)

lint: document the difference between FARG and PUSH

Revision 1.21 / (download) - annotate - [select for diffs], Tue Aug 10 06:31:16 2021 UTC (2 years, 8 months ago) by rillig
Branch: MAIN
Changes since 1.20: +25 -3 lines
Diff to previous 1.20 (colored) to selected 1.27 (colored)

lint: document operator properties directly at the definition

Revision 1.20 / (download) - annotate - [select for diffs], Thu Apr 1 14:59:21 2021 UTC (3 years ago) by rillig
Branch: MAIN
CVS Tags: cjep_sun2x-base1, cjep_sun2x-base, cjep_sun2x, cjep_staticlib_x-base1, cjep_staticlib_x-base, cjep_staticlib_x
Changes since 1.19: +71 -71 lines
Diff to previous 1.19 (colored) to selected 1.27 (colored)

lint: replace empty macro arguments with non-empty arguments

Empty arguments are a new feature of C99.  Since lint is one of the
build tools, it is supposed to only use C90 features.  C99 6.10.3 "Macro
replacement" explicitly allows empty macro arguments while C90 3.8.3
"Macro replacement" last sentence defines an empty macro argument as
undefined behavior.

This change makes the '1's stick out less from the table.  I tried to
use '.' instead of '-' as well, but that made it too hard to see the
commas.

No functional change.

Revision 1.19 / (download) - annotate - [select for diffs], Sat Mar 20 20:39:35 2021 UTC (3 years ago) by rillig
Branch: MAIN
Changes since 1.18: +74 -74 lines
Diff to previous 1.18 (colored) to selected 1.27 (colored)

lint: remove redundant operator properties table

It's enough to have modtab, which describes the properties of the
various operators.  There is no need to have a second table imods that
holds the same content.  Rather make modtab constant as well.

The only possible functional change is that the names of the internal
operators 'no-op', '++', '--', 'real', 'imag' and 'case' may appear in
diagnostics, where previously lint invoked undefined behavior by passing
a null pointer for a '%s' conversion specifier.

Revision 1.18 / (download) - annotate - [select for diffs], Sat Mar 20 20:15:37 2021 UTC (3 years ago) by rillig
Branch: MAIN
Changes since 1.17: +8 -8 lines
Diff to previous 1.17 (colored) to selected 1.27 (colored)

lint: fix argument names and table headings for operator definitions

The abbreviations in the table of operator properties had been wrong
since ops.def 1.10 from 2021-01-12, when strict bool mode was added.  In
an earlier working draft, I had named that column 'takes_others' instead
of 'requires_bool', that's where the 'o' came from.

The names of the macro arguments had been wrong since op.h 1.11 from
2021-01-09, when the order of the columns changed and the macros were
not adjusted accordingly.  Since all the properties of the operator
table are uniform, this didn't result in any bugs, it was just confusing
for human readers.

Clang-tidy suggests to enclose the macro arguments in oper.c in
parentheses but that is not possible since the arguments are either
empty or 1, and the syntactical ambiguity of the '+ 0' being either a
unary or a binary operator is needed here.

No change to the resulting binary.

Revision 1.17 / (download) - annotate - [select for diffs], Thu Mar 18 21:56:34 2021 UTC (3 years, 1 month ago) by rillig
Branch: MAIN
Changes since 1.16: +2 -2 lines
Diff to previous 1.16 (colored) to selected 1.27 (colored)

lint: rename operator 'const' to 'constant'

The previous name could be too easily confused with the type qualifier
'const'.  The operator name is mainly used in the debug log, only
occasionally in the output.  Since 'constant' is not a "real" operator,
it probably doesn't occur in messages at all.

Revision 1.16 / (download) - annotate - [select for diffs], Sat Feb 20 18:02:58 2021 UTC (3 years, 1 month ago) by rillig
Branch: MAIN
Changes since 1.15: +2 -1 lines
Diff to previous 1.15 (colored) to selected 1.27 (colored)

lint: add test for using a bool as array index in strict bool mode

Revision 1.15 / (download) - annotate - [select for diffs], Sun Jan 17 15:06:54 2021 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.14: +4 -4 lines
Diff to previous 1.14 (colored) to selected 1.27 (colored)

lint: rename bitwise operators

When there are several variants of the AND operator, both of them should
get a distinguishing prefix, otherwise it's not clear which of the two
possible operators is meant by the plain AND.

Revision 1.14 / (download) - annotate - [select for diffs], Sun Jan 17 14:55:22 2021 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.13: +2 -2 lines
Diff to previous 1.13 (colored) to selected 1.27 (colored)

lint: rename operator STAR to INDIR

C99 calls this operator the "indirection operator".  The word "star"
does not occur in the index of that standard.

Revision 1.13 / (download) - annotate - [select for diffs], Sun Jan 17 14:50:11 2021 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.12: +2 -2 lines
Diff to previous 1.12 (colored) to selected 1.27 (colored)

lint: rename operator AMPER to ADDR

There is no operator called 'ampersand'.  The ampersand sign is merely
the textual representation of both the operator ADDR and the operator
BITAND.

Revision 1.12 / (download) - annotate - [select for diffs], Sat Jan 16 19:03:47 2021 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.11: +3 -3 lines
Diff to previous 1.11 (colored) to selected 1.27 (colored)

lint: in strict bool mode, perform the normal checks as well

Revision 1.11 / (download) - annotate - [select for diffs], Fri Jan 15 22:07:54 2021 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.10: +2 -2 lines
Diff to previous 1.10 (colored) to selected 1.27 (colored)

lint: in strict bool mode, allow bool as operands of the comma operator

Revision 1.10 / (download) - annotate - [select for diffs], Tue Jan 12 20:42:01 2021 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.9: +75 -75 lines
Diff to previous 1.9 (colored) to selected 1.27 (colored)

lint: add new check for strict bool mode

In strict bool mode, bool is considered incompatible with all other
scalar types, just as in Java, C#, Pascal.

The controlling expressions in if statements, while loops, for loops and
the '?:' operator must be of type bool.  The logical operators work on
bool instead of int, the bitwise operators accept both integer and bool.
The arithmetic operators don't accept bool.

Since <stdbool.h> implements bool using C preprocessor macros instead of
predefining the identifiers "true" and "false", the integer constants 0
and 1 may be used in all contexts that require a bool expression.
Except from these, no implicit conversion between bool and scalar types
is allowed.

See usr.bin/tests/xlint/lint1/d_c99_bool_strict.c for more details.

The command line option -T has been chosen because all obvious choices
(-b or -B for bool, -s or -S for strict) are already in use.  The -T may
stand for "types are checked strictly".

The default behavior of lint doesn't change.  The strict bool check is
purely optional.

An example program for strict bool mode is usr.bin/make, which has been
using explicit comparisons such as p != NULL, ch != '\0' or n > 0 in
most places for a long time now, even before the refactoring in 2020.

Revision 1.9 / (download) - annotate - [select for diffs], Sat Jan 9 22:19:11 2021 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.8: +78 -63 lines
Diff to previous 1.8 (colored) to selected 1.27 (colored)

lint: make the table containing the operator properties more readable

The C preprocessor does not require its arguments to be expressions, an
empty string is valid as well.  This allows to replace the 0 in the
operator properties table with a space, making the 1 stick out.

Since the table is quite long, divide it into sections and add section
headers.

No change in the generated code.

Revision 1.8 / (download) - annotate - [select for diffs], Sat Jan 9 17:36:10 2021 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.7: +52 -52 lines
Diff to previous 1.7 (colored) to selected 1.27 (colored)

lint: reorder table of operator properties

The 4 "requires" properties are now listed together, in descending
strictness.

Revision 1.7 / (download) - annotate - [select for diffs], Tue Jan 5 23:50:29 2021 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.6: +77 -62 lines
Diff to previous 1.6 (colored) to selected 1.27 (colored)

lint: clean up generation of the operator tables

Instead of running a shell program that runs an AWK program that
generates the two files ops.c and ops.h, just define the operator tables
once in ops.def and use these definitions flexibly in ops.c and op.h.

Revision 1.6 / (download) - annotate - [select for diffs], Tue Jan 5 23:07:49 2021 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.5: +47 -47 lines
Diff to previous 1.5 (colored) to selected 1.27 (colored)

lint: clean up symbolic operator names that are used in the messages

Including the "p" in the symbolic operator names was questionable, for
several reasons:

1.  The "p" could be taken to mean an actual variable name, which is
    confusing if the function doesn't have such a variable, or even more
    so if the line contains an unrelated variable called "p".

2.  For the binary operators, having the "p" mentioned on both sides of
    the operator (such as in "p + p") wrongly suggested that both
    operands of the expression were the same.

3.  The name "p" often stands for a pointer.  Most of the operators
    don't accept pointers, therefore the name was misleading.

For these reasons, the "p" was removed from the symbolic name of all
operators.  This makes several pairs of operators indistinguishable:

    INCBEF == INCAFT
    DECBEF == DECAFT
    UPLUS == PLUS
    UMINUS == MINUS
    STAR == MULT
    AMPER == AND

This is not expected to create any confusion since C programmers are
expected to know these double meanings.

The symbolic names for SHLASS and SHRASS were missing the '=' before.
This was added since omitting it was probably an oversight.

Revision 1.5 / (download) - annotate - [select for diffs], Tue Jan 5 21:40:42 2021 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.4: +62 -62 lines
Diff to previous 1.4 (colored) to selected 1.27 (colored)

lint: swap columns 1 and 2 in ops.def

List the ID of a record first, followed by the describing fields.

Revision 1.4 / (download) - annotate - [select for diffs], Tue Jan 5 21:32:47 2021 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.3: +62 -62 lines
Diff to previous 1.3 (colored) to selected 1.27 (colored)

lint: make generating the operators table simpler

The generated files are exactly the same as before.

Revision 1.3 / (download) - annotate - [select for diffs], Tue Jan 5 16:34:37 2021 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.2: +4 -4 lines
Diff to previous 1.2 (colored) to selected 1.27 (colored)

lint: fix inconsistent whitespace in ops.def

Revision 1.2.2.2 / (download) - annotate - [select for diffs], Tue Feb 8 16:20:13 2011 UTC (13 years, 2 months ago) by bouyer
Branch: bouyer-quota2
Changes since 1.2.2.1: +62 -0 lines
Diff to previous 1.2.2.1 (colored) to branchpoint 1.2 (colored) next main 1.3 (colored) to selected 1.27 (colored)

Sync with HEAD

Revision 1.2.2.1, Sat Feb 5 17:14:14 2011 UTC (13 years, 2 months ago) by bouyer
Branch: bouyer-quota2
Changes since 1.2: +0 -62 lines
FILE REMOVED

file ops.def was added on branch bouyer-quota2 on 2011-02-08 16:20:13 +0000

Revision 1.2 / (download) - annotate - [select for diffs], Sat Feb 5 17:14:14 2011 UTC (13 years, 2 months ago) by christos
Branch: MAIN
CVS Tags: yamt-pagecache-tag8, yamt-pagecache-base9, yamt-pagecache-base8, yamt-pagecache-base7, yamt-pagecache-base6, yamt-pagecache-base5, yamt-pagecache-base4, yamt-pagecache-base3, yamt-pagecache-base2, yamt-pagecache-base, yamt-pagecache, tls-maxphys-base, tls-maxphys, tls-earlyentropy-base, tls-earlyentropy, riastradh-xf86-video-intel-2-7-1-pre-2-21-15, riastradh-drm2-base3, riastradh-drm2-base2, riastradh-drm2-base1, riastradh-drm2-base, riastradh-drm2, prg-localcount2-base3, prg-localcount2-base2, prg-localcount2-base1, prg-localcount2-base, prg-localcount2, phil-wifi-base, phil-wifi-20200421, phil-wifi-20200411, phil-wifi-20200406, phil-wifi-20191119, phil-wifi-20190609, phil-wifi, pgoyette-localcount-base, pgoyette-localcount-20170426, pgoyette-localcount-20170320, pgoyette-localcount-20170107, pgoyette-localcount-20161104, pgoyette-localcount-20160806, pgoyette-localcount-20160726, pgoyette-localcount, pgoyette-compat-merge-20190127, pgoyette-compat-base, pgoyette-compat-20190127, pgoyette-compat-20190118, pgoyette-compat-1226, pgoyette-compat-1126, pgoyette-compat-1020, pgoyette-compat-0930, pgoyette-compat-0906, pgoyette-compat-0728, pgoyette-compat-0625, pgoyette-compat-0521, pgoyette-compat-0502, pgoyette-compat-0422, pgoyette-compat-0415, pgoyette-compat-0407, pgoyette-compat-0330, pgoyette-compat-0322, pgoyette-compat-0315, pgoyette-compat, perseant-stdc-iso10646-base, perseant-stdc-iso10646, netbsd-9-base, netbsd-9-3-RELEASE, netbsd-9-2-RELEASE, netbsd-9-1-RELEASE, netbsd-9-0-RELEASE, netbsd-9-0-RC2, netbsd-9-0-RC1, netbsd-9, netbsd-8-base, netbsd-8-2-RELEASE, netbsd-8-1-RELEASE, netbsd-8-1-RC1, netbsd-8-0-RELEASE, netbsd-8-0-RC2, netbsd-8-0-RC1, netbsd-8, netbsd-7-nhusb-base-20170116, netbsd-7-nhusb-base, netbsd-7-nhusb, netbsd-7-base, netbsd-7-2-RELEASE, netbsd-7-1-RELEASE, netbsd-7-1-RC2, netbsd-7-1-RC1, netbsd-7-1-2-RELEASE, netbsd-7-1-1-RELEASE, netbsd-7-1, netbsd-7-0-RELEASE, netbsd-7-0-RC3, netbsd-7-0-RC2, netbsd-7-0-RC1, netbsd-7-0-2-RELEASE, netbsd-7-0-1-RELEASE, netbsd-7-0, netbsd-7, netbsd-6-base, netbsd-6-1-RELEASE, netbsd-6-1-RC4, netbsd-6-1-RC3, netbsd-6-1-RC2, netbsd-6-1-RC1, netbsd-6-1-5-RELEASE, netbsd-6-1-4-RELEASE, netbsd-6-1-3-RELEASE, netbsd-6-1-2-RELEASE, netbsd-6-1-1-RELEASE, netbsd-6-1, netbsd-6-0-RELEASE, netbsd-6-0-RC2, netbsd-6-0-RC1, netbsd-6-0-6-RELEASE, netbsd-6-0-5-RELEASE, netbsd-6-0-4-RELEASE, netbsd-6-0-3-RELEASE, netbsd-6-0-2-RELEASE, netbsd-6-0-1-RELEASE, netbsd-6-0, netbsd-6, matt-nb8-mediatek-base, matt-nb8-mediatek, matt-nb6-plus-nbase, matt-nb6-plus-base, matt-nb6-plus, localcount-20160914, is-mlppp-base, is-mlppp, cherry-xenmp-base, cherry-xenmp, bouyer-socketcan-base1, bouyer-socketcan-base, bouyer-socketcan, bouyer-quota2-nbase, bouyer-quota2-base, agc-symver-base, agc-symver
Branch point for: bouyer-quota2
Changes since 1.1: +62 -62 lines
Diff to previous 1.1 (colored) to selected 1.27 (colored)

as promised make the last ops table auto-generated.

Revision 1.1 / (download) - annotate - [select for diffs], Fri Feb 4 23:32:44 2011 UTC (13 years, 2 months ago) by christos
Branch: MAIN
Diff to selected 1.27 (colored)

generate ops table dynamically. Will move the other table from tree.c there
too.

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.




CVSweb <webmaster@jp.NetBSD.org>