might_sleep: Make file parameter const char *
Fixes a warning when building with g++:
warning: deprecated conversion from string constant to 'char*'
And the file parameter use is constant, so mark it as such.
--- include/linux/kernel.h | 5 +++-- kernel/sched.c | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-)
include/linux/kernel.h +3 -2
@@ -124,7 +124,7 @@ extern int _cond_resched(void);#endif #ifdef CONFIG_DEBUG_SPINLOCK_SLEEP -void __might_sleep (char *file,int line,int preempt_offset); +void __might_sleep (const char *file,int line,int preempt_offset);/** * might_sleep - annotation for functions that can sleep *
@@ -138,7 +138,8 @@ extern int _cond_resched(void);# define might_sleep () \ do { __might_sleep(__FILE__, __LINE__, 0); might_resched(); } while (0)#else -static inline void __might_sleep (char *file,int line,int preempt_offset) { } +static inline void __might_sleep (const char *file,int line, +int preempt_offset) { }# define might_sleep () do { might_resched(); } while (0)#endif
kernel/sched.c +1 -1
@@ -9695,7 +9695,7 @@ static inline int preempt_count_equals(int preempt_offset)return (nested ==PREEMPT_INATOMIC_BASE + preempt_offset); } -void __might_sleep (char *file,int line,int preempt_offset) +void __might_sleep (const char *file,int line,int preempt_offset) {#ifdef in_atomicstatic unsigned long prev_jiffy;/* ratelimiting */
Signature · 1 line
1.6.0.4
[tip:sched/urgent] sched: might_sleep(): Make file parameter const char *
Commit-ID: d894837f23f491aa7ed167aae767fc07cfe6e6e6 Gitweb: http://git.kernel.org/tip/d894837f23f491aa7ed167aae767fc07cfe6e6e6 Author: Simon Kagstrom <[email protected]> AuthorDate: Wed, 23 Dec 2009 11:08:18 +0100 Committer: Ingo Molnar <[email protected]> CommitDate: Mon, 28 Dec 2009 10:50:13 +0100
sched: might_sleep(): Make file parameter const char *
Fixes a warning when building with g++:
warning: deprecated conversion from string constant to 'char*'
And the file parameter use is constant, so mark it as such.
LKML-Reference: <[email protected]>
--- include/linux/kernel.h | 5 +++-- kernel/sched.c | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-)
include/linux/kernel.h +3 -2
@@ -124,7 +124,7 @@ extern int _cond_resched(void);#endif #ifdef CONFIG_DEBUG_SPINLOCK_SLEEP -void __might_sleep (char *file,int line,int preempt_offset); +void __might_sleep (const char *file,int line,int preempt_offset);/** * might_sleep - annotation for functions that can sleep *
@@ -138,7 +138,8 @@ extern int _cond_resched(void);# define might_sleep () \ do { __might_sleep(__FILE__, __LINE__, 0); might_resched(); } while (0)#else -static inline void __might_sleep (char *file,int line,int preempt_offset) { } +static inline void __might_sleep (const char *file,int line, +int preempt_offset) { }# define might_sleep () do { might_resched(); } while (0)#endif
kernel/sched.c +1 -1
@@ -9694,7 +9694,7 @@ static inline int preempt_count_equals(int preempt_offset)return (nested ==PREEMPT_INATOMIC_BASE + preempt_offset); } -void __might_sleep (char *file,int line,int preempt_offset) +void __might_sleep (const char *file,int line,int preempt_offset) {#ifdef in_atomicstatic unsigned long prev_jiffy;/* ratelimiting */
Re: [tip:sched/urgent] sched: might_sleep(): Make file parameter const char *
Quoted 1 line · tip-bot for Simon Kagstrom
Fixes a warning when building with g++:
However did you manage to build stuff with g++? The kernel very frequently uses C++ keywords for other things.
Re: [tip:sched/urgent] sched: might_sleep(): Make file parameter const char *
Quoted 6 lines · Peter Zijlstra
Quoted 1 line · tip-bot for Simon Kagstrom
Fixes a warning when building with g++:
However did you manage to build stuff with g++? The kernel very frequently uses C++ keywords for other things.
yeah, good question. Alas the change itself (const propagation) looked good so i applied it.
Ingo
Re: [tip:sched/urgent] sched: might_sleep(): Make file parameter const char *
In reply to Peter Zijlstra(Back from vacation, hence the delayed response)
Quoted 6 lines · On Tue, 29 Dec 2009 13:11:48 +0100 Peter Zijlstra <[email protected]> wrote:
Quoted 1 line · tip-bot for Simon Kagstrom
Fixes a warning when building with g++:
However did you manage to build stuff with g++? The kernel very frequently uses C++ keywords for other things.
I expected this question :-)
Yes, there are some workarounds we have to make to get it compiling (like #define new NEW prior to including the headers), but it works out. I know this is something you shouldn't do, and I debated whether to mention C++ at all.
Anyway, I think the change itself makes sense for plain C as well. The comment just described the context where it showed up for us.
// Simon
Re: [tip:sched/urgent] sched: might_sleep(): Make file parameter const char *
Quoted 14 lines · Simon Kagstrom
(Back from vacation, hence the delayed response)
Quoted 6 lines · On Tue, 29 Dec 2009 13:11:48 +0100 Peter Zijlstra <[email protected]> wrote:
Quoted 1 line · tip-bot for Simon Kagstrom
Fixes a warning when building with g++:
However did you manage to build stuff with g++? The kernel very frequently uses C++ keywords for other things.
I expected this question :-)
Quoted 8 lines
Yes, there are some workarounds we have to make to get it compiling (like #define new NEW prior to including the headers), but it works out. I know this is something you shouldn't do, and I debated whether to mention C++ at all.
Anyway, I think the change itself makes sense for plain C as well. The comment just described the context where it showed up for us.
Oh sure, the change is fine, just wondering what specific drug you were using as it was not the regular kernel kind ;-)