Commit 8e8801b
committed
cast const ptr: remove some unneeded code
- remove some unneeded paramaters
- tidy up changelog.txt
This commit is the end point in a series of changes since revision 145c13f.
This series of commits relates to errors and warnings on usafe CONST usage with respect to CONST qualifiers, assignments, argument passing, conversions, casting, and overloaded functions (both user and built-in)
In general:
1) some unsafe CONST usages are now errors
2) many unsage CONST usages are reported when using '-w constness' compiler warning option
#642 Pointer casting allows constness dropping
Unsafe statements not reporting any warning or error. The fix probably occurred over several revisions due to several related bugs. Revision numbers below are approximate.
In revision approx 7185995, a warning is generated for this unsafe usage but only when '-w constness' warning is specified. Internal implementation was modified in the source revisions following.
```
#pragma constness=true
dim as const integer a = 256
*cast( integer ptr, @A ) = 257 '' unsafe, warning with -w constness
poke integer, @A, 257 '' unsafe, warning with -w constness
```
In revision 2960949 for bug fix #727, adds CONST qualifiers to prototypes for fb rtlib built-in functions. We get an error due the incompatible and unsafe CONSTs.
```
dim as const integer a = 256
clear a, 0, sizeof(integer) '' unsafe, error
print a '' 0
```
Consider this bug report fixed. Promoting warnings to errors, specifically with CAST, CPTR, STRPTR, etc should be considered a different issue and a new bug ticket.
#886 Inconsistent error with BYREF and CAST on CONST variables
Fixed approx revision 612162a and on going implementation changes in the following revisions. Fixed by preserving the conversions, even CONST only conversions in the AST tree. For some expressions, there is no symbol associated, so AST needs to preserve the CONSTness of an expression so that it can be correctly type checked later.
#801 parser allows more constructs under -exx than without it
Fixed at revision 391527e. Requires bug fix #886, and adds and additional code to solve out null pointer where not needed.
#880 Overload binary operators do not support covariant arguments
Fixed at revision 208fad4. Maybe "changed" is better descriptor. Needs more testing.
#727 RTL functions not checking Constness unless marked RTL_CONST
All built-in RTL functions now have CONST added, where CONST is applicable.
Even though 'BYVAL' and 'BYVAL as CONST' are identical, and the compiler disregards any difference between the two, BYVAL parameters also carry the CONST attribute. The reason is that BYVAL/BYREF conveys one kind of information and CONST/non-CONST conveys another, and there is no harm (that I know of) to be more explicit.1 parent 64d32f5 commit 8e8801b
File tree
4 files changed
+24
-28
lines changed- src/compiler
4 files changed
+24
-28
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
| 9 | + | |
8 | 10 | | |
9 | 11 | | |
10 | 12 | | |
| |||
15 | 17 | | |
16 | 18 | | |
17 | 19 | | |
18 | | - | |
| 20 | + | |
| 21 | + | |
19 | 22 | | |
20 | 23 | | |
21 | 24 | | |
| |||
68 | 71 | | |
69 | 72 | | |
70 | 73 | | |
| 74 | + | |
71 | 75 | | |
72 | 76 | | |
73 | 77 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
488 | 488 | | |
489 | 489 | | |
490 | 490 | | |
491 | | - | |
492 | 491 | | |
493 | 492 | | |
494 | | - | |
| 493 | + | |
495 | 494 | | |
496 | | - | |
497 | | - | |
498 | | - | |
499 | | - | |
500 | | - | |
501 | | - | |
502 | | - | |
503 | | - | |
504 | | - | |
505 | | - | |
506 | | - | |
507 | 495 | | |
508 | 496 | | |
509 | 497 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1877 | 1877 | | |
1878 | 1878 | | |
1879 | 1879 | | |
1880 | | - | |
1881 | | - | |
1882 | | - | |
| 1880 | + | |
1883 | 1881 | | |
1884 | 1882 | | |
1885 | 1883 | | |
| |||
1979 | 1977 | | |
1980 | 1978 | | |
1981 | 1979 | | |
1982 | | - | |
| 1980 | + | |
1983 | 1981 | | |
1984 | 1982 | | |
1985 | 1983 | | |
1986 | 1984 | | |
1987 | 1985 | | |
1988 | 1986 | | |
1989 | 1987 | | |
1990 | | - | |
1991 | 1988 | | |
1992 | 1989 | | |
1993 | 1990 | | |
| |||
1997 | 1994 | | |
1998 | 1995 | | |
1999 | 1996 | | |
| 1997 | + | |
| 1998 | + | |
| 1999 | + | |
| 2000 | + | |
2000 | 2001 | | |
2001 | 2002 | | |
2002 | 2003 | | |
| |||
2053 | 2054 | | |
2054 | 2055 | | |
2055 | 2056 | | |
2056 | | - | |
| 2057 | + | |
2057 | 2058 | | |
2058 | 2059 | | |
2059 | 2060 | | |
| |||
2072 | 2073 | | |
2073 | 2074 | | |
2074 | 2075 | | |
2075 | | - | |
2076 | 2076 | | |
2077 | 2077 | | |
2078 | 2078 | | |
| 2079 | + | |
| 2080 | + | |
| 2081 | + | |
| 2082 | + | |
| 2083 | + | |
| 2084 | + | |
| 2085 | + | |
| 2086 | + | |
2079 | 2087 | | |
2080 | 2088 | | |
2081 | | - | |
2082 | 2089 | | |
2083 | 2090 | | |
2084 | 2091 | | |
2085 | | - | |
| 2092 | + | |
2086 | 2093 | | |
2087 | 2094 | | |
2088 | 2095 | | |
2089 | 2096 | | |
2090 | | - | |
| 2097 | + | |
2091 | 2098 | | |
2092 | 2099 | | |
2093 | 2100 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1878 | 1878 | | |
1879 | 1879 | | |
1880 | 1880 | | |
1881 | | - | |
1882 | | - | |
1883 | | - | |
| 1881 | + | |
1884 | 1882 | | |
1885 | 1883 | | |
1886 | 1884 | | |
| |||
1891 | 1889 | | |
1892 | 1890 | | |
1893 | 1891 | | |
1894 | | - | |
1895 | 1892 | | |
1896 | 1893 | | |
1897 | 1894 | | |
| |||
0 commit comments