incubator-lucy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marvin Humphrey (JIRA)" <>
Subject [jira] Commented: (LUCY-71) Remove Perl dependency of METAQUOTE
Date Thu, 28 Jan 2010 00:24:34 GMT


Marvin Humphrey commented on LUCY-71:

It turns out that the following construct generates a warning under GCC:

char stuff[] = QUOTE(\
  #include <stdio.h>
  int main() {
    printf("Greetings, earthlings.\n");
    return 0;

"foo.c:23:5: warning: embedding a directive within macro arguments is not portable"

Thus, my forthcoming patch takes this tack instead:

char stuff[] = 
  QUOTE(  #include <stdio.h>                     )
  QUOTE(  int main() {                           )
  QUOTE(    printf("Greetings, earthlings.\n");  )
  QUOTE(    return 0;                            )
  QUOTE(  }                                      );

It works fine so long as there are no unmated parentheses on any given line.  

The vim highlighter doesn't really like curly braces within parens, but other
than that, the construct seems to work ok.

> Remove Perl dependency of METAQUOTE
> -----------------------------------
>                 Key: LUCY-71
>                 URL:
>             Project: Lucy
>          Issue Type: Improvement
>          Components: Charmonizer
>            Reporter: Nathan Kurz
>            Priority: Minor
>         Attachments: charm_and_harm_to_c_and_h.diff
>   Original Estimate: 168h
>  Remaining Estimate: 168h
> Charmonizer currently uses a Perl script 'METAQUOTE' to preprocess its '.charm' files
into '.c' files and '.harm' files into '.h' files.   This works, but requires a dependency
on Perl that seems inappropriate for a C language tool.
> The suggested alternatives were to use manual quoting or standard macros.  
> Manual quoting seemed error prone and cumbersome, so this patch proposes the using the
'stringify' (#expr) function within standard C preprocessor macros.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message