function return type for enum roa
Ondrej Zajicek
santiago at crfreenet.org
Fri Oct 18 14:32:46 CEST 2024
On Fri, Oct 18, 2024 at 04:54:23PM +1300, James via Bird-users wrote:
> Hello,
>
> I tried to create a function that returns enum roa. However, I'm
> encountering difficulties specifying its return type.
>
> ```
>
> function check_clearnet_roa() {
> case net.type {
> NET_IP4: return roa_check(clearnet_roa_v4, net, bgp_path.last);
> NET_IP6: return roa_check(clearnet_roa_v6, net, bgp_path.last);
> else: print "is_roa_invalid: ", "unexpected net.type ", net.type, "
> ", net; return ROA_UNKNOWN;
> }
> }
>
> ```
>
> If I use "-> enum roa" as return type, birdcl co ch will return
> "clearnet.conf:143:34 syntax error, unexpected CF_SYM_UNDEFINED".
>
> If I use "-> 'enum roa'" as return type, birdcl co ch will return
> "clearnet.conf:143:39 Invalid character in apostrophed symbol".
>
> If I don't specify its return type, bird issues the warning
> "clearnet.conf:145:71: Inferring function check_clearnet_roa return type
> from its return value: enum roa".
>
>
> How should I correctly specify its return type?
Hello
Good catch, seems like the enum types exist on semantic level, but not
on syntactic level, so cannot be used in code. Will fix that.
--
Elen sila lumenn' omentielvo
Ondrej 'Santiago' Zajicek (email: santiago at crfreenet.org)
"To err is human -- to blame it on a computer is even more so."
More information about the Bird-users
mailing list