diff mbox

[RFC-PATCH,2/3] test: removing current dir from -I

Message ID 1437666275-24455-3-git-send-email-christophe.milard@linaro.org
State New
Headers show

Commit Message

Christophe Milard July 23, 2015, 3:44 p.m. UTC
The goal of this patch is to remove the src directory
and current directory from the standard include search
path (gcc -I<path>), so that #include <...> and #include "..."
actually search different locations.
This enables standard filenames (such as errno.h) to be used
locally.

Signed-off-by: Christophe Milard <christophe.milard@linaro.org>
---
 test/Makefile.inc            | 5 ++---
 test/validation/Makefile.inc | 2 ++
 2 files changed, 4 insertions(+), 3 deletions(-)

Comments

Stuart Haslam July 23, 2015, 5:37 p.m. UTC | #1
On Thu, Jul 23, 2015 at 05:44:34PM +0200, Christophe Milard wrote:
> The goal of this patch is to remove the src directory
> and current directory from the standard include search
> path (gcc -I<path>), so that #include <...> and #include "..."
> actually search different locations.
> This enables standard filenames (such as errno.h) to be used
> locally.
> 
> Signed-off-by: Christophe Milard <christophe.milard@linaro.org>
> ---
>  test/Makefile.inc            | 5 ++---
>  test/validation/Makefile.inc | 2 ++
>  2 files changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/test/Makefile.inc b/test/Makefile.inc
> index d5b4770..2700b18 100644
> --- a/test/Makefile.inc
> +++ b/test/Makefile.inc
> @@ -6,8 +6,7 @@ LIB   = $(top_builddir)/lib
>  #before libodp by setting PRE_LDADD before the inclusion.
>  LDADD = $(PRE_LDADD) $(LIB)/libodphelper.la $(LIB)/libodp.la
>  
> -INCFLAGS = -I$(srcdir) \
> -	-I$(top_srcdir)/test \
> +INCFLAGS = -I$(top_srcdir)/test \
>  	-I$(top_srcdir)/platform/@with_platform@/include \
>  	-I$(top_srcdir)/platform/linux-generic/include \
>  	-I$(top_srcdir)/include \
> @@ -20,4 +19,4 @@ AM_LDFLAGS += -L$(LIB)
>  @VALGRIND_CHECK_RULES@
>  valgrind_tools = memcheck drd sgcheck
>  
> -TESTS_ENVIRONMENT= ODP_PLATFORM=${with_platform} EXEEXT=${EXEEXT}
> \ No newline at end of file
> +TESTS_ENVIRONMENT= ODP_PLATFORM=${with_platform} EXEEXT=${EXEEXT}
> diff --git a/test/validation/Makefile.inc b/test/validation/Makefile.inc
> index 31729b8..fcaf5a5 100644
> --- a/test/validation/Makefile.inc
> +++ b/test/validation/Makefile.inc
> @@ -1,5 +1,7 @@
>  include $(top_srcdir)/test/Makefile.inc
>  
> +DEFAULT_INCLUDES =
> +

./bootstrap doesn't like this;

+ automake --add-missing --copy --warnings=all
test/validation/buffer/../Makefile.inc:3: warning: user variable 'DEFAULT_INCLUDES' defined here ...
test/validation/buffer/Makefile.am:1:   'test/validation/buffer/../Makefile.inc' included from here
/usr/share/automake-1.14/am/compile.am: ... overrides Automake variable 'DEFAULT_INCLUDES' defined here
test/validation/classification/../Makefile.inc:3: warning: user variable 'DEFAULT_INCLUDES' defined here ...

I had a google and found some suggestions to use the nostdinc option;

https://www.gnu.org/software/automake/manual/html_node/Program-Variables.html

Adding this to Makefile.inc allows it to build;

AUTOMAKE_OPTIONS = nostdinc
Christophe Milard July 24, 2015, 7:45 a.m. UTC | #2
Thanks for spotting this warnings, Stuart.
Actually, it seems that "AUTOMAKE_OPTIONS = nostdinc" makes a better job,
as I don't seem to have to redefine DEFAULT_INCLUDES at all when using the
option.
The question still remains though: Is this a good enough way to solve the
problem? Going off from the defaults seems not very good, but at the same
time, having -I. as default looks strange to me...
Shall I create a patch with this...?

On 23 July 2015 at 19:37, Stuart Haslam <stuart.haslam@linaro.org> wrote:

> On Thu, Jul 23, 2015 at 05:44:34PM +0200, Christophe Milard wrote:
> > The goal of this patch is to remove the src directory
> > and current directory from the standard include search
> > path (gcc -I<path>), so that #include <...> and #include "..."
> > actually search different locations.
> > This enables standard filenames (such as errno.h) to be used
> > locally.
> >
> > Signed-off-by: Christophe Milard <christophe.milard@linaro.org>
> > ---
> >  test/Makefile.inc            | 5 ++---
> >  test/validation/Makefile.inc | 2 ++
> >  2 files changed, 4 insertions(+), 3 deletions(-)
> >
> > diff --git a/test/Makefile.inc b/test/Makefile.inc
> > index d5b4770..2700b18 100644
> > --- a/test/Makefile.inc
> > +++ b/test/Makefile.inc
> > @@ -6,8 +6,7 @@ LIB   = $(top_builddir)/lib
> >  #before libodp by setting PRE_LDADD before the inclusion.
> >  LDADD = $(PRE_LDADD) $(LIB)/libodphelper.la $(LIB)/libodp.la
> >
> > -INCFLAGS = -I$(srcdir) \
> > -     -I$(top_srcdir)/test \
> > +INCFLAGS = -I$(top_srcdir)/test \
> >       -I$(top_srcdir)/platform/@with_platform@/include \
> >       -I$(top_srcdir)/platform/linux-generic/include \
> >       -I$(top_srcdir)/include \
> > @@ -20,4 +19,4 @@ AM_LDFLAGS += -L$(LIB)
> >  @VALGRIND_CHECK_RULES@
> >  valgrind_tools = memcheck drd sgcheck
> >
> > -TESTS_ENVIRONMENT= ODP_PLATFORM=${with_platform} EXEEXT=${EXEEXT}
> > \ No newline at end of file
> > +TESTS_ENVIRONMENT= ODP_PLATFORM=${with_platform} EXEEXT=${EXEEXT}
> > diff --git a/test/validation/Makefile.inc b/test/validation/Makefile.inc
> > index 31729b8..fcaf5a5 100644
> > --- a/test/validation/Makefile.inc
> > +++ b/test/validation/Makefile.inc
> > @@ -1,5 +1,7 @@
> >  include $(top_srcdir)/test/Makefile.inc
> >
> > +DEFAULT_INCLUDES =
> > +
>
> ./bootstrap doesn't like this;
>
> + automake --add-missing --copy --warnings=all
> test/validation/buffer/../Makefile.inc:3: warning: user variable
> 'DEFAULT_INCLUDES' defined here ...
> test/validation/buffer/Makefile.am:1:
>  'test/validation/buffer/../Makefile.inc' included from here
> /usr/share/automake-1.14/am/compile.am: ... overrides Automake variable
> 'DEFAULT_INCLUDES' defined here
> test/validation/classification/../Makefile.inc:3: warning: user variable
> 'DEFAULT_INCLUDES' defined here ...
>
> I had a google and found some suggestions to use the nostdinc option;
>
>
> https://www.gnu.org/software/automake/manual/html_node/Program-Variables.html
>
> Adding this to Makefile.inc allows it to build;
>
> AUTOMAKE_OPTIONS = nostdinc
>
> --
> Stuart.
>
Stuart Haslam July 24, 2015, 8:34 a.m. UTC | #3
On Fri, Jul 24, 2015 at 09:45:13AM +0200, Christophe Milard wrote:
> Thanks for spotting this warnings, Stuart.
> Actually, it seems that "AUTOMAKE_OPTIONS = nostdinc" makes a better job,
> as I don't seem to have to redefine DEFAULT_INCLUDES at all when using the
> option.
> The question still remains though: Is this a good enough way to solve the
> problem? Going off from the defaults seems not very good, but at the same
> time, having -I. as default looks strange to me...
> Shall I create a patch with this...?

Yes, IMO this is the best way around the problem.

It's probably worth adding a little comment as to why it's there, as
others including the file (e.g. from under platform/<plat>/test) will
need to do the same in future.
Christophe Milard July 24, 2015, 8:38 a.m. UTC | #4
Ok. thanks. I'll add a comment and send a v2 of the patch series populating
the libs, with this included, if that is OK with you. (I am currentely
rebasing the serie as it now conflicts with the double includes guards you
added).
Christophe.

On 24 July 2015 at 10:34, Stuart Haslam <stuart.haslam@linaro.org> wrote:

> On Fri, Jul 24, 2015 at 09:45:13AM +0200, Christophe Milard wrote:
> > Thanks for spotting this warnings, Stuart.
> > Actually, it seems that "AUTOMAKE_OPTIONS = nostdinc" makes a better job,
> > as I don't seem to have to redefine DEFAULT_INCLUDES at all when using
> the
> > option.
> > The question still remains though: Is this a good enough way to solve the
> > problem? Going off from the defaults seems not very good, but at the same
> > time, having -I. as default looks strange to me...
> > Shall I create a patch with this...?
>
> Yes, IMO this is the best way around the problem.
>
> It's probably worth adding a little comment as to why it's there, as
> others including the file (e.g. from under platform/<plat>/test) will
> need to do the same in future.
>
> --
> Stuart.
>
diff mbox

Patch

diff --git a/test/Makefile.inc b/test/Makefile.inc
index d5b4770..2700b18 100644
--- a/test/Makefile.inc
+++ b/test/Makefile.inc
@@ -6,8 +6,7 @@  LIB   = $(top_builddir)/lib
 #before libodp by setting PRE_LDADD before the inclusion.
 LDADD = $(PRE_LDADD) $(LIB)/libodphelper.la $(LIB)/libodp.la
 
-INCFLAGS = -I$(srcdir) \
-	-I$(top_srcdir)/test \
+INCFLAGS = -I$(top_srcdir)/test \
 	-I$(top_srcdir)/platform/@with_platform@/include \
 	-I$(top_srcdir)/platform/linux-generic/include \
 	-I$(top_srcdir)/include \
@@ -20,4 +19,4 @@  AM_LDFLAGS += -L$(LIB)
 @VALGRIND_CHECK_RULES@
 valgrind_tools = memcheck drd sgcheck
 
-TESTS_ENVIRONMENT= ODP_PLATFORM=${with_platform} EXEEXT=${EXEEXT}
\ No newline at end of file
+TESTS_ENVIRONMENT= ODP_PLATFORM=${with_platform} EXEEXT=${EXEEXT}
diff --git a/test/validation/Makefile.inc b/test/validation/Makefile.inc
index 31729b8..fcaf5a5 100644
--- a/test/validation/Makefile.inc
+++ b/test/validation/Makefile.inc
@@ -1,5 +1,7 @@ 
 include $(top_srcdir)/test/Makefile.inc
 
+DEFAULT_INCLUDES =
+
 AM_CFLAGS += -I$(top_srcdir)/test/validation/common
 AM_LDFLAGS += -static