File: constpfx

package info (click to toggle)
tcng 10b-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 3,632 kB
  • ctags: 2,515
  • sloc: ansic: 19,038; pascal: 4,640; yacc: 2,619; sh: 1,908; perl: 1,546; lex: 772; makefile: 755
file content (27 lines) | stat: -rw-r--r-- 894 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# 1.2.3.4/24 does not yield warning -------------------------------------------
tcc -c -Wnounused 2>&1
$x = 1.2.3.4/24;
EOF
# 1.2.3.4/24 does yield warning with -Wconstpfx -------------------------------
tcc -c -Wnounused -Wconstpfx 2>&1
$x = 1.2.3.4/24;
EOF
<stdin>:1: warning: taking prefix of constant (and not field) near ";"
# ::/24 does yield warning with -Wconstpfx ------------------------------------
tcc -c -Wnounused 2>&1
warn "constpfx";
$x = ::/24;
EOF
<stdin>:2: warning: taking prefix of constant (and not field) near ";"
# ip_src/24 does not yield warning --------------------------------------------
tcc -c -Wconstpfx 2>&1
prio {
    drop if ip_src/24;
}
EOF
# 1.2.3.4/5.6.7.8 yields error, no warning ------------------------------------
tcc -c -Wconstpfx 2>&1
$x = 1.2.3.4/5.6.7.8;
EOF
ERROR
<stdin>:1: invalid types for operator "/" (IPv4 address and IPv4 address) near ";"