[ragel-users] "declared but not used" errors with v7 Go backend

Adrian Thurston thurston at colm.net
Tue Nov 27 06:01:17 UTC 2018


 

What ... gcc is at version 8? Where have I been? 

Hmm, okay not seeing anything I can fix in the distribution. Seems just
some configuration needs to change for building on mac. 

On 2018-11-25 11:36, Damian Gryski wrote: 

> Yes, I had to change the call to libtoolize to glibtoolize so it picked up the version installed by brew and not Apple's version. 
> 
> Next, I needed to pass CXX=g++-8 so it used the gcc installed by brew and not Apple's version of llvm. 
> 
> Finally, I needed to also build colm from git and not use the latest release tarball 0.13.0.6. 
> 
> Damian 
> 
> On Sun, Nov 25, 2018 at 5:18 AM Adrian Thurston <thurston at colm.net> wrote: 
> 
> Just added the assignment to _ to master. 
> 
> Thank you for the fix. 
> 
> Still having problems building master? 
> 
> On 2018-11-01 10:12, Damian Gryski wrote: 
> 
> This is with ragel 7.0.0.11 and colm 0.13.0.6. I was unable to get ragel to build from git. 
> 
> With the example grammar at github.com/dgryski/ragel-examples/regexp1 [2], I get the following error: 
> 
> $ ragel-go sshd.rl 
> $ go build 
> # github.com/dgryski/ragel-examples/regexp1 [2] 
> ./sshd.go:11:6: _scanner_trans_cond_spaces declared and not used 
> ./sshd.go:12:6: _scanner_trans_offsets declared and not used 
> ./sshd.go:13:6: _scanner_trans_lengths declared and not used 
> ./sshd.go:14:6: _scanner_cond_keys declared and not used 
> ./sshd.go:17:6: _scanner_eof_cond_spaces declared and not used 
> ./sshd.go:18:6: _scanner_eof_cond_key_offs declared and not used 
> ./sshd.go:19:6: _scanner_eof_cond_key_lens declared and not used 
> ./sshd.go:20:6: _scanner_eof_cond_keys declared and not used 
> ./sshd.go:21:6: _scanner_nfa_targs declared and not used 
> ./sshd.go:22:6: _scanner_nfa_offsets declared and not used 
> ./sshd.go:22:6: too many errors 
> 
> The usual solution to this in autogenerated code is to assign them to `_`, the underscore "blank variable". This satisfies the compiler and the entire array will be eliminated as a dead-store if it ends up not being used. 
> 
> Thus, each declaration for variables which may or may not be used will look like: 
> var _scanner_trans_cond_spaces [] int8 = [] int8 { ... } 
> _ = _scanner_trans_cond_space 
> 
> Note also the first `[] int8` is redundant -- the compiler will infer the type from the type of the array on the right hand side of the `=`. 
> 
> Fixing these issues in the Go template in the src/host-go directory and rebuilding fixed these errors (although I had to copy files from the git checkout for the template changes to recompile successfully). 
> 
> Damian 
> 
> _______________________________________________
> ragel-users mailing list
> ragel-users at colm.net
> http://www.colm.net/cgi-bin/mailman/listinfo/ragel-users [1]
> 
> _______________________________________________
> ragel-users mailing list
> ragel-users at colm.net
> http://www.colm.net/cgi-bin/mailman/listinfo/ragel-users [1]

_______________________________________________
ragel-users mailing list
ragel-users at colm.net
http://www.colm.net/cgi-bin/mailman/listinfo/ragel-users [1]

 

Links:
------
[1] http://www.colm.net/cgi-bin/mailman/listinfo/ragel-users
[2] http://github.com/dgryski/ragel-examples/regexp1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.colm.net/pipermail/ragel-users/attachments/20181127/82936494/attachment.html>


More information about the ragel-users mailing list