Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Possible syntax error in C module

Status
Not open for further replies.

Spab23

Programmer
Jul 22, 2003
43
CA
I am trying to add the mod_extract_forwarded module to IHS (IBM's Apache) v2.0 and then I try to compile it with apxs, I get:

Code:
../bin/apxs -c -i -a ../var/custom_modules/extract_forwarded/mod_extract_forwarded.c
/usr/HTTPServer2047/build/libtool --silent --mode=compile xlc_r -prefer-pic -O2 -qmaxmem=8192  -U__STR__ -D_THREAD_SAFE -D_USE_IRS -qHALT=E -I/usr/HTTPServer2047/include  -I/usr/HTTPServer2047/include   -I/usr/HTTPServer2047/include   -c -o ../var/custom_modules/extract_forwarded/mod_extract_forwarded.lo ../var/custom_modules/extract_forwarded/mod_extract_forwarded.c && touch ../var/custom_modules/extract_forwarded/mod_extract_forwarded.slo
"../var/custom_modules/extract_forwarded/mod_extract_forwarded.c", line 1004.5: 1506-275 (S) Unexpected text 'char' encountered. apxs:Error: Command failed with rc=65536

The section of the module it's complaining about is:

Code:
static const char *const mef_proxy_b4[] = { "proxy_http.c", NULL };

I'll cross post this on the Apache forum as well.

Can anyone help me? Is there a syntax error in the C code?

Thanks!!
 
This is the entire block of code:

Code:
/*--------------------------------------------------------------------------*/
/*                                                                          */
/* Data structures pulling all the mef module's bits together               */
/*                                                                          */
/*--------------------------------------------------------------------------*/
/*
 * mef module's functions attached to request processing hooks.
 */
static void mef_register_hooks(apr_pool_t *p)
{
    ap_hook_post_read_request(mef_post_read_request, NULL, NULL,
                              APR_HOOK_FIRST);
    ap_hook_translate_name(mef_uri_translate, NULL, NULL, APR_HOOK_FIRST);
/*
 * This hook shouldn't be needed as as subrequest should enter at URI translate
 * or access control/check but uncomment it if you think you need it
 *    ap_hook_header_parser(mef_header_parser, NULL, NULL, APR_HOOK_FIRST);
 */
    ap_hook_access_checker(mef_access_check, NULL, NULL, APR_HOOK_FIRST);
#ifdef USING_proxy_http_module
    /*
     * Only need to register the following handlers if proxy_http_module
     * is going to be loaded
     */
    static const char *const mef_proxy_b4[] = { "proxy_http.c", NULL };
    proxy_hook_scheme_handler(mef_before_proxy_http, NULL, mef_proxy_b4,
                              APR_HOOK_FIRST);
    ap_hook_log_transaction(mef_logging, NULL, NULL, APR_HOOK_FIRST);
#endif /* USING_proxy_http_module */
}
 
> Is there a syntax error in the C code?
Yes, it seems that what you have there is either C99 code or C++ code.

Normal ANSI-C doesn't have mixed declarations and statements. When your USING_proxy_http_module is defined, you have a declaration immediately following a statement.

Now you can get round this by introducing another block
Code:
#ifdef USING_proxy_http_module
  [b]{[/b]
    /*
     * Only need to register the following handlers if proxy_http_module
     * is going to be loaded
     */
    static const char *const mef_proxy_b4[] = { "proxy_http.c", NULL };
    proxy_hook_scheme_handler(mef_before_proxy_http, NULL, mef_proxy_b4,
                              APR_HOOK_FIRST);
    ap_hook_log_transaction(mef_logging, NULL, NULL, APR_HOOK_FIRST);
  [b]}[/b]
#endif /* USING_proxy_http_module */
Note the extra pair of braces to introduce another block which permits the declarations to be made according to normal C rules.

--
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top