mm: Suppress mm/memory.o warning on older compilers if !CONFIG_NUMA_BALANCING
Subsystems (2)
PATCH 1/1 mm: Suppress mm/memory.o warning on older compilers if !CONFIG_NUMA_BALANCING
The kbuild test robot reported the following after the merge of Automatic NUMA Balancing when cross-compiling for avr32.
mm/memory.c: In function 'do_pmd_numa_page':mm/memory.c:3593: warning: no return statement in function returning non-void
The code is unreachable but the avr32 cross-compiler was not new enough to know that. This patch suppresses the warning.
--- mm/memory.c | 1 + 1 file changed, 1 insertion(+)
mm/memory.c +1 -0
@@ -3590,6 +3590,7 @@ static int do_pmd_numa_page(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long addr, pmd_t *pmdp) {BUG (); +return 0 ; }#endif /* CONFIG_NUMA_BALANCING */
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Andrew Morton
maintainerQuoted 19 lines · On Mon, 17 Dec 2012 11:49:17 +0000 Mel Gorman <[email protected]> wrote:
The kbuild test robot reported the following after the merge of Automatic NUMA Balancing when cross-compiling for avr32.
mm/memory.c: In function 'do_pmd_numa_page':mm/memory.c:3593: warning: no return statement in function returning non-voidThe code is unreachable but the avr32 cross-compiler was not new enough to know that. This patch suppresses the warning.
Signed-off-by Mel Gorman <[email protected]>--- mm/memory.c | 1 + 1 file changed, 1 insertion(+)mm/memory.c +0
-0
mm/memory.c static int do_pmd_numa_page(struct mm_struct *mm, struct vm_area_struct *vma, · line 3595
Quoted 6 lines
mm/memory.c +1
-0@@ -3590,6 +3590,7 @@ static int do_pmd_numa_page(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long addr, pmd_t *pmdp) {BUG (); +return 0 ; }#endif /* CONFIG_NUMA_BALANCING */
Odd. avr32's BUG() includes a call to unreachable(), which should evaluate to "do { } while (1)". Can you check that this is working?
Perhaps it _is_ working, but the compiler incorrectly thinks that the function can return?
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 29 lines · Andrew Morton
Quoted 19 lines
The kbuild test robot reported the following after the merge of Automatic NUMA Balancing when cross-compiling for avr32.
mm/memory.c: In function 'do_pmd_numa_page':mm/memory.c:3593: warning: no return statement in function returning non-voidThe code is unreachable but the avr32 cross-compiler was not new enough to know that. This patch suppresses the warning.
Signed-off-by Mel Gorman <[email protected]>--- mm/memory.c | 1 + 1 file changed, 1 insertion(+)mm/memory.c +0
-0mm/memory.c static int do_pmd_numa_page(struct mm_struct *mm, struct vm_area_struct *vma, · line 3595
Quoted 6 lines
mm/memory.c +1
-0@@ -3590,6 +3590,7 @@ static int do_pmd_numa_page(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long addr, pmd_t *pmdp) {BUG (); +return 0 ; }#endif /* CONFIG_NUMA_BALANCING */ Odd. avr32's
BUG()includes a call tounreachable(), which should evaluate to "do { } while (1)". Can you check that this is working?
Quoted 3 lines
Perhaps it _is_ working, but the compiler incorrectly thinks that the function can return?
This isn't the typical "control reaches end of non-void function", the warning is merely stating there is no return statement in the function which happens to be the case (and it has nothing to do with avr32, it will be the same on all archs). This is one of the last things that gcc does after it parses a function declaration and will be emitted with -Wreturn-type unless the function in question is main() and it isn't marked with __attribute__((noreturn)). If you're testing this, try making the function statically defined and it should show up even with do {} while(1).
And for CONFIG_BUG=n this ends up being do {} while (0) which is just a no-op and would end up returning that "control reaches end of non-void function" warning.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>