Quantcast

Sorting through #includes

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Sorting through #includes

Rik-4
I made a task on Savannah to clean up the #includes in Octave
(https://savannah.gnu.org/task/index.php?14501).

Here is what I wrote:

I ran include-what-you-use on the Octave code base to get an idea of which
declarations are unnecessary and where we are in fact missing declarations.

The tool is very much imperfect, but I can see there are some problems that
could be corrected. Unfortunately, this will require manual review of the
results. For instance, the tool completely misunderstands that config.h is
always included and by extension oct-conf-post.h is also included. The
suggestion to remove config.h and add oct-conf-post.h should be ignored.

Because this is such a big job I am uploading the log file and asking that
anyone who has free time tackle a few files.  Only by dividing up the work
can it all get done.

For reference, the Octave coding guidelines for the order of #includes is

+verbatim+
config.h

C standard lib headers

C++ standard lib headers

liboctave headers

other headers
-verbatim-

Within each category the headers are alphabetized.

As an example, here is the list for libinterp/corefcn/__delaunayn__.cc

+verbatim+
#if defined (HAVE_CONFIG_H)
#  include "config.h"
#endif

#include <cstdio>

#include <limits>
#include <string>

#include "Array.h"
#include "dMatrix.h"
#include "dRowVector.h"
#include "oct-locbuf.h"
#include "unwind-prot.h"

#include "defun-dld.h"
#include "error.h"
#include "errwarn.h"
#include "ovl.h"
-verbatim-

--Rik


Loading...