Re: [PATCH] x86, acpi: LLVMLinux: Remove nested functions from Thinkpad ACPI

2014-02-13 Thread Henrique de Moraes Holschuh
On Wed, 12 Feb 2014, dl...@gmx.de wrote:
> From: Behan Webster 
> The only real change is passing in event_mask to the formerly nested 
> functions.
> Otherwise it's just moving around function and macro code.
> 
> This is the only place in the Linux kernel where nested functions are still in
> use. Nested functions aren't part of the C standards, and complicate the
> generated code. Although the Linux Kernel has never set out to be entirely C
> standard compliant, it is increasingly compliant to the standard which is
> supported by other compilers such as Clang. The LLVMLinux project is working 
> on
> being able to compile the Linux kernel with Clang. The use of nested functions
> blocks this effort.
> 
> Signed-off-by: Behan Webster 
> Signed-off-by: Jan-Simon Möller 
> 
> CC: David Woodhouse 
> CC: Matthew Garrett 
> CC: ibm-acpi-de...@lists.sourceforge.net
> CC: platform-driver-...@vger.kernel.org
> CC: linux-kernel@vger.kernel.org

Acked-by: Henrique de Moraes Holschuh 

-- 
  "One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie." -- The Silicon Valley Tarot
  Henrique Holschuh
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] x86, acpi: LLVMLinux: Remove nested functions from Thinkpad ACPI

2014-02-13 Thread Henrique de Moraes Holschuh
On Wed, 12 Feb 2014, dl...@gmx.de wrote:
 From: Behan Webster beh...@converseincode.com
 The only real change is passing in event_mask to the formerly nested 
 functions.
 Otherwise it's just moving around function and macro code.
 
 This is the only place in the Linux kernel where nested functions are still in
 use. Nested functions aren't part of the C standards, and complicate the
 generated code. Although the Linux Kernel has never set out to be entirely C
 standard compliant, it is increasingly compliant to the standard which is
 supported by other compilers such as Clang. The LLVMLinux project is working 
 on
 being able to compile the Linux kernel with Clang. The use of nested functions
 blocks this effort.
 
 Signed-off-by: Behan Webster beh...@converseincode.com
 Signed-off-by: Jan-Simon Möller dl...@gmx.de
 
 CC: David Woodhouse david.woodho...@intel.com
 CC: Matthew Garrett matthew.garr...@nebula.com
 CC: ibm-acpi-de...@lists.sourceforge.net
 CC: platform-driver-...@vger.kernel.org
 CC: linux-kernel@vger.kernel.org

Acked-by: Henrique de Moraes Holschuh h...@hmh.eng.br

-- 
  One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie. -- The Silicon Valley Tarot
  Henrique Holschuh
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] x86, acpi: LLVMLinux: Remove nested functions from Thinkpad ACPI

2014-02-12 Thread Al Viro
On Wed, Feb 12, 2014 at 01:54:43PM -0800, David Rientjes wrote:

> So this patch is only as a courtesy to clang and you're not complaining 
> about things like __builtin() functions, typeof, or a ? : b conditional 
> operators because clang happens to support them?

That patch removes a disgusting construct; who cares how they'd discovered
it?  Consider it courtesy to reviewers, clang or no clang...

Folks, it's C; no need to bring Pascal misfeatures in, even if gcc happens
to accept them.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] x86, acpi: LLVMLinux: Remove nested functions from Thinkpad ACPI

2014-02-12 Thread David Rientjes
On Wed, 12 Feb 2014, dl...@gmx.de wrote:

> From: Behan Webster 
> 
> The only real change is passing in event_mask to the formerly nested 
> functions.
> Otherwise it's just moving around function and macro code.
> 
> This is the only place in the Linux kernel where nested functions are still in
> use. Nested functions aren't part of the C standards, and complicate the
> generated code. Although the Linux Kernel has never set out to be entirely C
> standard compliant, it is increasingly compliant to the standard which is
> supported by other compilers such as Clang. The LLVMLinux project is working 
> on
> being able to compile the Linux kernel with Clang. The use of nested functions
> blocks this effort.
> 

So this patch is only as a courtesy to clang and you're not complaining 
about things like __builtin() functions, typeof, or a ? : b conditional 
operators because clang happens to support them?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] x86, acpi: LLVMLinux: Remove nested functions from Thinkpad ACPI

2014-02-12 Thread Måns Rullgård
Behan Webster  writes:

> On 02/12/14 13:11, Christoph Hellwig wrote:
>> On Wed, Feb 12, 2014 at 09:58:46PM +0100, dl...@gmx.de wrote:
>>> being able to compile the Linux kernel with Clang. The use of nested 
>>> functions
>>> blocks this effort.
>> Is there any good way to make gcc warn about the use of nested functions?
> Interesting idea.
>
> '-Wtrampolines'
>  Warn about trampolines generated for pointers to nested functions.
>
>  A trampoline is a small piece of data or code that is created at
>  run time on the stack when the address of a nested function is
>  taken, and is used to call the nested function indirectly.  For
>  some targets, it is made up of data only and thus requires no
>  special treatment.  But, for most targets, it is made up of code
>  and thus requires the stack to be made executable in order for the
>  program to work properly.
>
> That might work.

That sounds like it will only warn if a trampoline is needed.  A nested
function whose address isn't taken, as is the case here, wouldn't
trigger this warning.

-- 
Måns Rullgård
m...@mansr.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] x86, acpi: LLVMLinux: Remove nested functions from Thinkpad ACPI

2014-02-12 Thread Richard Weinberger
On Wed, Feb 12, 2014 at 10:20 PM, Behan Webster
 wrote:
> On 02/12/14 13:11, Christoph Hellwig wrote:
>>
>> On Wed, Feb 12, 2014 at 09:58:46PM +0100, dl...@gmx.de wrote:
>>>
>>> being able to compile the Linux kernel with Clang. The use of nested
>>> functions
>>> blocks this effort.
>>
>> Is there any good way to make gcc warn about the use of nested functions?
>
> Interesting idea.
>
> '-Wtrampolines'
>  Warn about trampolines generated for pointers to nested functions.
>
>  A trampoline is a small piece of data or code that is created at
>  run time on the stack when the address of a nested function is
>  taken, and is used to call the nested function indirectly.  For
>  some targets, it is made up of data only and thus requires no
>  special treatment.  But, for most targets, it is made up of code
>  and thus requires the stack to be made executable in order for the
>  program to work properly.
>
>
> That might work.

I gave it a quick try, but gcc (4.7) did not bark.

-- 
Thanks,
//richard
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] x86, acpi: LLVMLinux: Remove nested functions from Thinkpad ACPI

2014-02-12 Thread Behan Webster

On 02/12/14 13:11, Christoph Hellwig wrote:

On Wed, Feb 12, 2014 at 09:58:46PM +0100, dl...@gmx.de wrote:

being able to compile the Linux kernel with Clang. The use of nested functions
blocks this effort.

Is there any good way to make gcc warn about the use of nested functions?

Interesting idea.

'-Wtrampolines'
 Warn about trampolines generated for pointers to nested functions.

 A trampoline is a small piece of data or code that is created at
 run time on the stack when the address of a nested function is
 taken, and is used to call the nested function indirectly.  For
 some targets, it is made up of data only and thus requires no
 special treatment.  But, for most targets, it is made up of code
 and thus requires the stack to be made executable in order for the
 program to work properly.


That might work.

Behan

--
Behan Webster
beh...@converseincode.com

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] x86, acpi: LLVMLinux: Remove nested functions from Thinkpad ACPI

2014-02-12 Thread Christoph Hellwig
On Wed, Feb 12, 2014 at 09:58:46PM +0100, dl...@gmx.de wrote:
> being able to compile the Linux kernel with Clang. The use of nested functions
> blocks this effort.

Is there any good way to make gcc warn about the use of nested functions?

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] x86, acpi: LLVMLinux: Remove nested functions from Thinkpad ACPI

2014-02-12 Thread Christoph Hellwig
On Wed, Feb 12, 2014 at 09:58:46PM +0100, dl...@gmx.de wrote:
 being able to compile the Linux kernel with Clang. The use of nested functions
 blocks this effort.

Is there any good way to make gcc warn about the use of nested functions?

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] x86, acpi: LLVMLinux: Remove nested functions from Thinkpad ACPI

2014-02-12 Thread Behan Webster

On 02/12/14 13:11, Christoph Hellwig wrote:

On Wed, Feb 12, 2014 at 09:58:46PM +0100, dl...@gmx.de wrote:

being able to compile the Linux kernel with Clang. The use of nested functions
blocks this effort.

Is there any good way to make gcc warn about the use of nested functions?

Interesting idea.

'-Wtrampolines'
 Warn about trampolines generated for pointers to nested functions.

 A trampoline is a small piece of data or code that is created at
 run time on the stack when the address of a nested function is
 taken, and is used to call the nested function indirectly.  For
 some targets, it is made up of data only and thus requires no
 special treatment.  But, for most targets, it is made up of code
 and thus requires the stack to be made executable in order for the
 program to work properly.


That might work.

Behan

--
Behan Webster
beh...@converseincode.com

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] x86, acpi: LLVMLinux: Remove nested functions from Thinkpad ACPI

2014-02-12 Thread Richard Weinberger
On Wed, Feb 12, 2014 at 10:20 PM, Behan Webster
beh...@converseincode.com wrote:
 On 02/12/14 13:11, Christoph Hellwig wrote:

 On Wed, Feb 12, 2014 at 09:58:46PM +0100, dl...@gmx.de wrote:

 being able to compile the Linux kernel with Clang. The use of nested
 functions
 blocks this effort.

 Is there any good way to make gcc warn about the use of nested functions?

 Interesting idea.

 '-Wtrampolines'
  Warn about trampolines generated for pointers to nested functions.

  A trampoline is a small piece of data or code that is created at
  run time on the stack when the address of a nested function is
  taken, and is used to call the nested function indirectly.  For
  some targets, it is made up of data only and thus requires no
  special treatment.  But, for most targets, it is made up of code
  and thus requires the stack to be made executable in order for the
  program to work properly.


 That might work.

I gave it a quick try, but gcc (4.7) did not bark.

-- 
Thanks,
//richard
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] x86, acpi: LLVMLinux: Remove nested functions from Thinkpad ACPI

2014-02-12 Thread Måns Rullgård
Behan Webster beh...@converseincode.com writes:

 On 02/12/14 13:11, Christoph Hellwig wrote:
 On Wed, Feb 12, 2014 at 09:58:46PM +0100, dl...@gmx.de wrote:
 being able to compile the Linux kernel with Clang. The use of nested 
 functions
 blocks this effort.
 Is there any good way to make gcc warn about the use of nested functions?
 Interesting idea.

 '-Wtrampolines'
  Warn about trampolines generated for pointers to nested functions.

  A trampoline is a small piece of data or code that is created at
  run time on the stack when the address of a nested function is
  taken, and is used to call the nested function indirectly.  For
  some targets, it is made up of data only and thus requires no
  special treatment.  But, for most targets, it is made up of code
  and thus requires the stack to be made executable in order for the
  program to work properly.

 That might work.

That sounds like it will only warn if a trampoline is needed.  A nested
function whose address isn't taken, as is the case here, wouldn't
trigger this warning.

-- 
Måns Rullgård
m...@mansr.com
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] x86, acpi: LLVMLinux: Remove nested functions from Thinkpad ACPI

2014-02-12 Thread David Rientjes
On Wed, 12 Feb 2014, dl...@gmx.de wrote:

 From: Behan Webster beh...@converseincode.com
 
 The only real change is passing in event_mask to the formerly nested 
 functions.
 Otherwise it's just moving around function and macro code.
 
 This is the only place in the Linux kernel where nested functions are still in
 use. Nested functions aren't part of the C standards, and complicate the
 generated code. Although the Linux Kernel has never set out to be entirely C
 standard compliant, it is increasingly compliant to the standard which is
 supported by other compilers such as Clang. The LLVMLinux project is working 
 on
 being able to compile the Linux kernel with Clang. The use of nested functions
 blocks this effort.
 

So this patch is only as a courtesy to clang and you're not complaining 
about things like __builtin() functions, typeof, or a ? : b conditional 
operators because clang happens to support them?
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] x86, acpi: LLVMLinux: Remove nested functions from Thinkpad ACPI

2014-02-12 Thread Al Viro
On Wed, Feb 12, 2014 at 01:54:43PM -0800, David Rientjes wrote:

 So this patch is only as a courtesy to clang and you're not complaining 
 about things like __builtin() functions, typeof, or a ? : b conditional 
 operators because clang happens to support them?

That patch removes a disgusting construct; who cares how they'd discovered
it?  Consider it courtesy to reviewers, clang or no clang...

Folks, it's C; no need to bring Pascal misfeatures in, even if gcc happens
to accept them.
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/