[odb-users] odb location pragmas failure with boost and gcc 6

Roger Noble rnbzilla at gmail.com
Tue Dec 20 10:13:07 EST 2016


Hi,

I have a problem with an apparent interaction between odb location pragmas and 
the boost library headers with gcc 6.x and Fedora 25, though there was the 
same problem with Fedora 24.

The attached code snippet illustrates this, running odb on it with

odb --database mysql odbtest.h

produces the following errors:

odbtest.h:36:13: error: db pragma 'id' is not associated with a declaration
odbtest.h:36:17: error: db pragma 'auto' is not associated with a declaration
odbtest.h:24:12: error: db pragma 'object' is not associated with a 
declaration
odbtest.h:24:19: error: db pragma 'table' is not associated with a declaration
odbtest.h:24:19: error: db pragma 'table' is not associated with a declaration

Remove any one of the boost includes and it works OK. Note however that it's 
not so simple as a single header file - other combinations of boost headers 
can produce the errors as well.

Poking around inside the parser code it appears that when it fails the insert 
of the location pragmas in parser::impl::emit_class

  // Add location pragmas if any.
  //
  {
    loc_pragmas::const_iterator i (loc_pragmas_.find (c));

    if (i != loc_pragmas_.end ())
      decls.insert (i->second.begin (), i->second.end ());
  }

is placing the pragmas into decls after the following declaration rather than 
before it. In parser::impl::tree_decl::operator< the numerical values of xloc 
and yloc when this happens are such that the pragma is placed after its 
declaration, although the file path and line and column numbers returned by 
LOCATION_FILE, LOCATION_LINE and LOCATION_COLUMN for both xloc and yloc are 
all correct.

There were no problems with gcc 5.x.

The versions in use are:

gcc 6.2.1 (Fedora 6.2.1-2.fc25)
odb 2.4.0 (Fedora 2.4.0-15.fc25)
boost 1.60 (Fedora 1.60.0-10.fc25)

both x86_64.

Regards,

Roger

-- 
Roger Noble                       rnbzilla at gmail.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: odbtest.h
Type: text/x-chdr
Size: 939 bytes
Desc: not available
Url : http://codesynthesis.com/pipermail/odb-users/attachments/20161220/14f9f186/odbtest.h


More information about the odb-users mailing list