foo.y: warning: conflicting outputs to file `foo.tab.hh'
It turns out that I was inadvertently giving the foo.tab.hh file as bison's -o parameter. Since the -o is supposed to be the .cc file ("foo.tab.cc"), bison derives the .hh file by chopping off the extension (to get "foo.tab.") and then adding "hh" (to get "foo.tab.hh"). Thus bison was writing both the .hh and .cc files to the same place.
The reason I was doing this is because my Makefile was messed up. I was using generic rules to build flex/bison files:
%.l.cc: %.l %.tab.hh
flex ... -o $@
%.tab.cc %.tab.hh: %.y
bison ... -o $@
Of course the flex run needs the foo.tab.hh file for all the state definitions, so the bison build is done first. But since it was foo.tab.hh that triggered the build, "$@" is set to the .hh file instead of the .cc file.
The only reason I'm babbling about this is because there's no good explanation of that bison message anywhere on google. Hopefully I'll save someone else some anguish. :)

You just saved me some anguish, thanks!
ReplyDeleteAnd me, many years later. Thanks!
ReplyDeleteAbsolute legend
ReplyDelete