lib: Add include guard to tst_safe_clocks.h

Message ID 20190320193718.2320-1-rafael.tinoco@linaro.org
State Superseded
Headers show
Series
  • lib: Add include guard to tst_safe_clocks.h
Related show

Commit Message

Rafael David Tinoco March 20, 2019, 7:37 p.m.
When adding a common header to my tests I missed this include guard when
accidentally including tst_safe_clocks.h from .c and .h files. Since
other tst_safe_*.h files have guards I thought it would be good to add
to this one as well.

Signed-off-by: Rafael David Tinoco <rafael.tinoco@linaro.org>
---
 include/tst_safe_clocks.h | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Enji Cooper (yaneurabeya) March 20, 2019, 7:38 p.m. | #1
> On Mar 20, 2019, at 12:37, Rafael David Tinoco <rafael.tinoco@linaro.org> wrote:

> 

> When adding a common header to my tests I missed this include guard when

> accidentally including tst_safe_clocks.h from .c and .h files. Since

> other tst_safe_*.h files have guards I thought it would be good to add

> to this one as well.

> 

> Signed-off-by: Rafael David Tinoco <rafael.tinoco@linaro.org>

> ---

> include/tst_safe_clocks.h | 5 +++++

> 1 file changed, 5 insertions(+)

> 

> diff --git a/include/tst_safe_clocks.h b/include/tst_safe_clocks.h

> index a952be4bf..0f642148e 100644

> --- a/include/tst_safe_clocks.h

> +++ b/include/tst_safe_clocks.h

> @@ -5,6 +5,9 @@

>  * Email : code@zilogic.com

>  */

> 

> +#ifndef TST_SAFE_CLOCK_H__

> +#define TST_SAFE_CLOCK_H__

> +

> #include <time.h>

> #include <sys/timex.h>

> #include "tst_test.h"

> @@ -69,3 +72,5 @@ static inline void safe_clock_adjtime(const char *file, const int lineno,

> 

> #define SAFE_CLOCK_ADJTIME(clk_id, txc)\

> 	safe_clock_adjtime(__FILE__, __LINE__, (clk_id), (txc))

> +

> +#endif /* SAFE_CLOCK_H__ */

> -- 

> 2.20.1



Ack.

Reviewed-by: Enji Cooper <yaneurabeya@gmail.com <mailto:yaneurabeya@gmail.com>>
<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Mar 20, 2019, at 12:37, Rafael David Tinoco &lt;<a href="mailto:rafael.tinoco@linaro.org" class="">rafael.tinoco@linaro.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">When adding a common header to my tests I missed this include guard when<br class="">accidentally including tst_safe_clocks.h from .c and .h files. Since<br class="">other tst_safe_*.h files have guards I thought it would be good to add<br class="">to this one as well.<br class=""><br class="">Signed-off-by: Rafael David Tinoco &lt;<a href="mailto:rafael.tinoco@linaro.org" class="">rafael.tinoco@linaro.org</a>&gt;<br class="">---<br class=""> include/tst_safe_clocks.h | 5 +++++<br class=""> 1 file changed, 5 insertions(+)<br class=""><br class="">diff --git a/include/tst_safe_clocks.h b/include/tst_safe_clocks.h<br class="">index a952be4bf..0f642148e 100644<br class="">--- a/include/tst_safe_clocks.h<br class="">+++ b/include/tst_safe_clocks.h<br class="">@@ -5,6 +5,9 @@<br class=""> &nbsp;* <a href="mailto:code@zilogic.com" class="">Email : code@zilogic.com</a><br class=""> &nbsp;*/<br class=""><br class="">+#ifndef TST_SAFE_CLOCK_H__<br class="">+#define TST_SAFE_CLOCK_H__<br class="">+<br class=""> #include &lt;time.h&gt;<br class=""> #include &lt;sys/timex.h&gt;<br class=""> #include "tst_test.h"<br class="">@@ -69,3 +72,5 @@ static inline void safe_clock_adjtime(const char *file, const int lineno,<br class=""><br class=""> #define SAFE_CLOCK_ADJTIME(clk_id, txc)\<br class=""> <span class="Apple-tab-span" style="white-space:pre">	</span>safe_clock_adjtime(__FILE__, __LINE__, (clk_id), (txc))<br class="">+<br class="">+#endif /* SAFE_CLOCK_H__ */<br class="">-- <br class="">2.20.1<br class=""></div></div></blockquote></div><div class=""><br class=""></div><div class="">Ack.</div><br class=""><div class="">Reviewed-by: Enji Cooper &lt;<a href="mailto:yaneurabeya@gmail.com" class="">yaneurabeya@gmail.com</a>&gt;</div></body></html>
Cyril Hrubis March 21, 2019, 11:07 a.m. | #2
Hi!
> When adding a common header to my tests I missed this include guard when
> accidentally including tst_safe_clocks.h from .c and .h files. Since
> other tst_safe_*.h files have guards I thought it would be good to add
> to this one as well.

This is obviously OK, but needs to be applied over the CLOCK_ADJTIME
patch (it would have been slightly better if it was part of that
patchset), I will apply it once the adjtime tests are merged...

Patch

diff --git a/include/tst_safe_clocks.h b/include/tst_safe_clocks.h
index a952be4bf..0f642148e 100644
--- a/include/tst_safe_clocks.h
+++ b/include/tst_safe_clocks.h
@@ -5,6 +5,9 @@ 
  * Email : code@zilogic.com
  */
 
+#ifndef TST_SAFE_CLOCK_H__
+#define TST_SAFE_CLOCK_H__
+
 #include <time.h>
 #include <sys/timex.h>
 #include "tst_test.h"
@@ -69,3 +72,5 @@  static inline void safe_clock_adjtime(const char *file, const int lineno,
 
 #define SAFE_CLOCK_ADJTIME(clk_id, txc)\
 	safe_clock_adjtime(__FILE__, __LINE__, (clk_id), (txc))
+
+#endif /* SAFE_CLOCK_H__ */