Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2007-10

Apache header translation Patch

16 messages · 5 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Inoussa OUEDRAOGO

Hi,

These patchs correct the cmd_func type in http_config.inc :
- 2.2-http_config.inc.diff for apache 2.2
- 2.0-http_config.inc.diff for apache 2.0

Thanks

Inoussa O.

Reply by email

Yury Sidorov
to Inoussa OUEDRAOGO: These patchs correct the cmd_func type in http_config.inc : - 2.2-http_config.inc.diff…

From: "Inoussa OUEDRAOGO"

Show quoted text 5 lines
Hi, These patchs correct the cmd_func type in http_config.inc : - 2.2-http_config.inc.diff for apache 2.2 - 2.0-http_config.inc.diff for apache 2.0

After your patch a warning appeared when compiling httpd-2.2:

http_config.inc(135,3) Warning: cdecl'ared functions have no high
parameter

Please take a look on it.

Yury.

Reply by email

Yury Sidorov
to Felipe Monteiro de Carvalho

From: "Felipe Monteiro de Carvalho"

Show quoted text 7 lines
On 11/1/07, Yury Sidorov wrote: > After your patch a warning appeared when compiling httpd-2.2: > > http_config.inc(135,3) Warning: cdecl'ared functions have no high > parameter I just built it with fpc 2.3 and I see no warning ... strange

Probably you have warning turned off. I get the following:

Free Pascal Compiler version 2.3.1 [2007/11/01] for i386 Copyright (c) 1993-2007 by Florian Klaempfl
Target OS: Win32 for i386
Compiling httpd.pas
http_config.inc(134,3) Warning: cdecl'ared functions have no high parameter
httpd.pas(158,32) Warning: Converting pointers to signed integers may result in wrong comparison results and range errors, use an unsigned type instead.
httpd.pas(165,28) Warning: Converting pointers to signed integers may result in wrong comparison results and range errors, use an unsigned type instead.
9395 lines compiled, 0.2 sec
3 warning(s) issued

Yury.

Reply by email

Inoussa OUEDRAOGO
to Yury Sidorov: From: "Inoussa OUEDRAOGO" After your patch a warning appeared when compiling httpd-2.2:…
After your patch a warning appeared when compiling httpd-2.2: http_config.inc(135,3) Warning: cdecl'ared functions have no high parameter

I manage to get a code snipet that produces the warning, I do not known how to suppress this
warning. Here is the code ( I compile with this command fpc -vw C:\tmp\b.pas )

<code>
{$mode objfpc}{$H+}
program test_var_args;
  type TFunc = function (argc: Integer; const argv: array of PChar):
PChar; cdecl;
begin
end.
</code>
Inoussa O.

Reply by email

Felipe Monteiro de Carvalho
to Inoussa OUEDRAOGO

More importantly then supressing it, which I consider something unimportant, would be knowing what it means, and if there is some kind of potential problem it indicates that we are overlooking.

Felipe Monteiro de Carvalho

Reply by email

Jonas Maebe
to Inoussa OUEDRAOGO: I manage to get a code snipet that produces the warning, I do not known how to suppress…
Inoussa OUEDRAOGO wrote 13 lines
I manage to get a code snipet that produces the warning, I do not known how to suppress this warning. Here is the code ( I compile with this command fpc -vw C: \tmp\b.pas ) <code> {$mode objfpc}{$H+} program test_var_args; type TFunc = function (argc: Integer; const argv: array of PChar): PChar; cdecl; begin end. </code>

You can't get rid of that warning, and it should actually even be worded more strongly. It is simply not possible to access C-style varargs parameters at the callee side in FPC (you may be able to hak using pointers which will work on some platforms, but it will crash and burn in most cases).

Jonas

Reply by email

Inoussa OUEDRAOGO
to Jonas Maebe
Show quoted text 5 lines
You can't get rid of that warning, and it should actually even be worded more strongly. It is simply not possible to access C-style varargs parameters at the callee side in FPC (you may be able to hak using pointers which will work on some platforms, but it will crash and burn in most cases).

This is the c prototype ( type ) translated, actualy it is a array of PCHAR.

<code taken from apache source>
const char *(*take_argv) (cmd_parms *parms, void *mconfig,

			     int argc, char *const argv[]);

</code>

Is the following translation valid ?

take_argv_t = function (parms: Pcmd_parms; mconfig: Pointer; argc:
cint; argv: array of PChar): PChar; cdecl;
Inoussa O.

Reply by email

Jonas Maebe
to Inoussa OUEDRAOGO
Inoussa OUEDRAOGO wrote 12 lines
This is the c prototype ( type ) translated, actualy it is a array of PCHAR. <code taken from apache source> const char *(*take_argv) (cmd_parms *parms, void *mconfig, int argc, char *const argv[]); </code> Is the following translation valid ? take_argv_t = function (parms: Pcmd_parms; mconfig: Pointer; argc: cint; argv: array of PChar): PChar; cdecl;

I think it's better to do this:

take_argv_t = function (parms: Pcmd_parms; mconfig: Pointer;
argc:cint; argv: PPChar): PChar; cdecl;

You can still index it as an array in FPC, but it's clearer what the actual type is that gets passed (an "array of pchar" is the same as a double pointer to char in C). I was indeed wrong about the varargs stuff I said earlier, for some reason I had read "array of pchar" as "array of const".

Jonas

Reply by email

Inoussa OUEDRAOGO
to Jonas Maebe
Show quoted text 23 lines
> This is the c prototype ( type ) translated, actualy it is a array > of PCHAR. > > <code taken from apache source> > const char *(*take_argv) (cmd_parms *parms, void *mconfig, > int argc, char *const argv[]); > </code> > > Is the following translation valid ? > > take_argv_t = function (parms: Pcmd_parms; mconfig: Pointer; argc: > cint; argv: array of PChar): PChar; cdecl; I think it's better to do this: take_argv_t = function (parms: Pcmd_parms; mconfig: Pointer; argc:cint; argv: PPChar): PChar; cdecl; You can still index it as an array in FPC, but it's clearer what the actual type is that gets passed (an "array of pchar" is the same as a double pointer to char in C). I was indeed wrong about the varargs stuff I said earlier, for some reason I had read "array of pchar" as "array of const".

Ok, Thanks.

By the way, h2pas should also be corrected, because it translates <code langage=c>

    void f(int a, char* p[]);
  </code>

to
<code langage=pascal>

    procedure f(a:longint; p:array of pchar);cdecl;external;
  </code>
Inoussa O.

Reply by email

Inoussa OUEDRAOGO
to Felipe Monteiro de Carvalho: More importantly then supressing it, which I consider something unimportant, would be…
More importantly then supressing it, which I consider something unimportant, would be knowing what it means, and if there is some kind of potential problem it indicates that we are overlooking.

Agree, clarified by Jonas's response .

By the way, have you been able to make a module on ( Linux + Apache 2.2.x ) ? I tried on
- Ubuntu + Apache 2.2.3/2.2.4
- Fedora + Apache 2.2.4
without succes. Even worse, in the handler proc, r^.handler ( used to test if this request
should be handled by the current module ) always holds some weird string,for a very basic
module. On windows it does work.

Inoussa O.

Reply by email

Marco van de Voort
to Inoussa OUEDRAOGO: Ok, Thanks. By the way, h2pas should also be corrected, because it translates <code…
Show quoted text 14 lines
> double pointer to char in C). I was indeed wrong about the varargs > stuff I said earlier, for some reason I had read "array of pchar" as > "array of const". Ok, Thanks. By the way, h2pas should also be corrected, because it translates <code langage=c> void f(int a, char* p[]); </code> to <code langage=pascal> procedure f(a:longint; p:array of pchar);cdecl;external; </code>

Please file a bug report with examples, so that it doesn't get forgotten.

Reply by email

Inoussa OUEDRAOGO
to Marco van de Voort

done : http://www.freepascal.org/mantis/view.php?id=10156

2007/11/12, Marco van de Voort :

Show quoted text 20 lines
> > double pointer to char in C). I was indeed wrong about the varargs > > stuff I said earlier, for some reason I had read "array of pchar" as > > "array of const". > Ok, Thanks. > > By the way, h2pas should also be corrected, because it translates > <code langage=c> > void f(int a, char* p[]); > </code> > > to > <code langage=pascal> > procedure f(a:longint; p:array of pchar);cdecl;external; > </code> Please file a bug report with examples, so that it doesn't get forgotten. _______________________________________________ fpc-devel maillist - http://lists.freepascal.org/mailman/listinfo/fpc-devel
Inoussa O.

Reply by email