[Click] Minimizing patch size

Philip Prindeville philipp_subx at redfish-solutions.com
Wed Jan 5 01:58:16 EST 2011


Ok, I just went back and looked at "click/cxxprotect.h" which includes redefinition for C++ keywords like "new" and "virtual".

So has anyone tried to compile Click with minimal patching (i.e. just what is necessary to add the required instrumentation and hooks) with a recent version of gcc (say 4.3.0 or later)?



On 1/4/11 7:59 PM, Philip Prindeville wrote:
> Ok, so it seems to me that the solution is twofold:
>
> (1) require a reasonably recent version of gcc;
> (2) In places where the 'new' keyword is used in header files for inlines, etc. do:
>
> #define new __new
> #include<linux/list.h>
> #undef new
>
>
>
>
> On 1/4/11 6:39 PM, Joonwoo Park wrote:
>> Hi,
>>
>> I don't think 'extern "C"' made any difference.  If you were able to
>> compile your example you should be able to compile even without
>> 'extern "C"' from your example.
>> Don't remember exact gcc version but IIRC earlier version of g++
>> parses '::' as namespace keyword always.  To support old versions,
>> patching '::' was necessary.
>>
>> Joonwoo
>>
>> On Tue, Jan 4, 2011 at 5:35 PM, Philip Prindeville
>> <philipp_subx at redfish-solutions.com>   wrote:
>>> On 1/4/11 12:25 PM, Joonwoo Park wrote:
>>>>        1  #include<iostream>
>>>>        2
>>>>        3  extern "C"
>>>>        4  {
>>>>        5  struct keyword {
>>>>        6          int new;
>>>>        7  };
>>>>        8  }
>>>>        9
>>>>       10  int main()
>>>>       11  {
>>>>       12          return 0;
>>>>       13  }
>>> I took that and modified it as:
>>>
>>> #include<iostream>
>>>
>>> extern "C"
>>> {
>>> #include<sys/types.h>
>>>
>>> void load_ldt(int32_t ldt)
>>> {
>>>          asm volatile("lldt %0"::"m" (ldt));
>>> }
>>> }
>>>
>>> int main()
>>> {
>>>          return 0;
>>> }
>>>
>>>
>>> and it compiled fine.
>>>
>>> So that solves part of the problem.
>>>
>>> -Philip
>>>
>>>
>>>
>



More information about the click mailing list