bugGNU Octave - Bugs: bug #53505, some public Octave headers fail to...

 
 

bug #53505: some public Octave headers fail to compile when included alone

Submitter:  Mike Miller <mtmiller>
Submitted:  Wed 28 Mar 2018 07:33:49 PM UTC
   
 
Category:  Libraries Severity:  2 - Minor
Priority:  3 - Low Item Group:  Other
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Mon 09 Apr 2018 08:03:57 PM UTC, comment #9: 


> I can look at eliminating ov-intx.h and mexproto.h so they can't cause trouble.


Ok.

> It should be fairly clear that a .cc file is not normally meant to be included alone.


Agree. GCC names its files .tcc, but again, the user is just supposed to know by convention that these files are not meant to be included directly.

> Maybe we can review them after the release?


Sounds good.

Mike Miller <mtmiller>
Group Member
Mon 09 Apr 2018 08:00:21 PM UTC, comment #8: 

I can look at eliminating ov-intx.h and mexproto.h so they can't cause trouble.

We also have some .cc files that are installed in the include directory because of the way our templates are defined.  I guess it is OK to leave them as template sources and continue to install them along with the headers in case someone needs to instantiate those templates for types that are not already provided by the Octave libraries.  It should be fairly clear that a .cc file is not normally meant to be included alone.

There may be other header files that we shouldn't be installing.  Maybe we can review them after the release?

John W. Eaton <jwe>
Group administrator
Mon 09 Apr 2018 06:23:33 PM UTC, comment #7: 

I think we can close this as fixed.

I will probably file a separate bug report for the further issue of trying to discourage users from including internal header files, but that's not as important.

Mike Miller <mtmiller>
Group Member
Mon 09 Apr 2018 04:59:24 PM UTC, comment #6: 

Regarding comment #3, is there a way to determine if a file is being #included in a .h file versus a .cc file?  Maybe through use of the _FILE_ macro?  A quick search was not very promising.  Maybe we should just call it a day and close this report.  The issue is already mostly resolved except for mexproto.h, ov-intx.h.

Rik <rik5>
Group administrator
Sat 07 Apr 2018 07:29:21 PM UTC, comment #5: 

That's basically how I tested.

Mike Miller <mtmiller>
Group Member
Sat 07 Apr 2018 07:21:51 PM UTC, comment #4: 

Also, for the record, here is what I did after installing octave with --prefix=$PREFIX:

Add $PREFIX/bin to my PATH

execute the shell command


for f in $(ls $PREFIX/include/octave-5.0.0/octave/*.h); do
  echo "#include \"$(basename $f)\"" > foo.cc
  mkoctfile -c foo.cc
  rm -f foo.cc
done


John W. Eaton <jwe>
Group administrator
Sat 07 Apr 2018 07:16:03 PM UTC, comment #3: 

I pushed the following changeset:

http://hg.savannah.gnu.org/hgweb/octave/rev/dd774017866b

The ones that still generate warnings or errors are:

mexproto.h, ov-intx.h:  These are not really supposed to be included by themselves, but only from other header files.  We could probably fix things so there is a meaningful error message if they are included some other way.

oct-obj.h, toplev.h:  These are deprecated.

John W. Eaton <jwe>
Group administrator
Sat 07 Apr 2018 05:13:58 PM UTC, comment #2: 

Minor, but it feels like the right thing to do.  Did you do an exhaustive test including each header file one-by-one, or were  these three identified by chance during other issuse?

jwe just split the development branch fully from the stable branch by updating the version number to 5.0.0 and removing deprecated functions.  It would be nice to settle this bug quickly on the development branch.

Rik <rik5>
Group administrator
Wed 28 Mar 2018 07:35:48 PM UTC, comment #1: 

This is not an important bug for 4.4.0.

Mike Miller <mtmiller>
Group Member
Wed 28 Mar 2018 07:33:49 PM UTC, original submission:  

Some Octave public header files fail to compile when they are included by themselves in a trivial C++ source file. This only affects a small minority of Octave header files, and they are probably all headers that normal users won't be including directly anyway.

However, I think these should probably be fixed so that headers that are available publicly can be included and compiled.

  • pt-unop.h - forward declaration of octave_value, but then tries to use octave_value::unary_op and octave_value::unknown_unary_op


  • sparse-chol.h - forward declaration of SparseComplexMatrix, but then tries to instantiate a template specialization on SparseComplexMatrix, template needs chol_type::element_type


  • sparse-qr.h - the Complex typedef is unknown, may be trivial to solve by including oct-cmplx.h
Mike Miller <mtmiller>
Group Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by mtmiller (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-04-09 mtmiller StatusNeed Info Fixed
        Open/ClosedOpen Closed
    2018-04-07 rik5 StatusNone Need Info
    2018-03-28 mtmiller Priority5 - Normal 3 - Low

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code