poke-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

jitter generates invalid C code in pvm-vm1.c


From: Bruno Haible
Subject: jitter generates invalid C code in pvm-vm1.c
Date: Sun, 21 Feb 2021 14:26:07 +0100
User-agent: KMail/5.1.3 (Linux/4.4.0-201-generic; KDE/5.18.0; x86_64; ; )

I'm attempting to compile poke with xlc on AIX.

It gives a bunch of syntax errors when compiling ../../libpoke/pvm-vm1.c:

"../../libpoke/pvm.jitter", line 5642.1: 1506-191 (E) The character # is not a 
valid C source character.
"../../libpoke/pvm.jitter", line 5642.7: 1506-277 (S) Syntax error: possible 
missing ')' or ','?
"../../libpoke/pvm.jitter", line 5641.5: 1506-045 (S) Undeclared identifier 
line.
"../../libpoke/pvm.jitter", line 5648.1: 1506-191 (E) The character # is not a 
valid C source character.
"../../libpoke/pvm.jitter", line 5648.7: 1506-277 (S) Syntax error: possible 
missing ')' or ','?
"../../libpoke/pvm.jitter", line 5654.1: 1506-191 (E) The character # is not a 
valid C source character.
"../../libpoke/pvm.jitter", line 5654.7: 1506-277 (S) Syntax error: possible 
missing ')' or ','?
"../../libpoke/pvm.jitter", line 5660.1: 1506-191 (E) The character # is not a 
valid C source character.
"../../libpoke/pvm.jitter", line 5660.7: 1506-277 (S) Syntax error: possible 
missing ')' or ','?
"../../libpoke/pvm.jitter", line 5666.1: 1506-191 (E) The character # is not a 
valid C source character.
"../../libpoke/pvm.jitter", line 5666.7: 1506-277 (S) Syntax error: possible 
missing ')' or ','?
"../../libpoke/pvm.jitter", line 5672.1: 1506-191 (E) The character # is not a 
valid C source character.
"../../libpoke/pvm.jitter", line 5672.7: 1506-277 (S) Syntax error: possible 
missing ')' or ','?
"../../libpoke/pvm.jitter", line 5678.1: 1506-191 (E) The character # is not a 
valid C source character.
"../../libpoke/pvm.jitter", line 5678.7: 1506-277 (S) Syntax error: possible 
missing ')' or ','?
"../../libpoke/pvm.jitter", line 5684.1: 1506-191 (E) The character # is not a 
valid C source character.
"../../libpoke/pvm.jitter", line 5684.7: 1506-277 (S) Syntax error: possible 
missing ')' or ','?
"../../libpoke/pvm.jitter", line 5690.1: 1506-191 (E) The character # is not a 
valid C source character.
"../../libpoke/pvm.jitter", line 5690.7: 1506-277 (S) Syntax error: possible 
missing ')' or ','?
gmake[1]: *** [Makefile:2471: libpvmjitter_la-pvm-vm1.lo] Error 1

What it complains about is this piece of pvm-vm1.c:

-------------------------------------------------------------------------------
#line 5637 "../../libpoke/pvm.jitter"
    JITTER_RULE_CONDITION_MATCH_OPCODE(1, drop)
    /* Check arguments, binding placeholders.  We don't have to worry */
    /* about arity, since the opcodes match if we're here. */
    /* Rule guard. */
    JITTER_RULE_CONDITION(
#line 5639 "../../libpoke/pvm.jitter"
      true
                         )
  JITTER_RULE_END_CONDITIONS
  JITTER_RULE_BEGIN_PLACEHOLDER_CLONING
  JITTER_RULE_END_PLACEHOLDER_CLONING
  JITTER_RULE_BEGIN_BODY
-------------------------------------------------------------------------------

This is invalid C code, because
  - ISO C forbids preprocessor directives inside macro arguments (see ISO C11
    ยง 6.10.3 (11)).
  - #line is a preprocessor directive,
  - JITTER_RULE_CONDITION is a macro.

When xlc preprocesses this invalid code, the result is

-------------------------------------------------------------------------------
#line 5639 "../../libpoke/pvm.jitter"
{ const int jitter_head_instruction_no = (2); const struct jitter_instruction * 
const * const jitter_candidate_instructions __attribute_
_ ((unused)) = (jitter_all_rewritable_instructions + 
jitter_rewritable_instruction_no - jitter_head_instruction_no);
#line 5642
  if ( (jitter_rewritable_instruction_no >= (jitter_head_instruction_no))
#line 5636 "../../libpoke/pvm.jitter"
    && (((jitter_candidate_instructions [0]) ->meta_instruction->id) == 
pvm_meta_instruction_id_swap)
#line 5637 "../../libpoke/pvm.jitter"
    && (((jitter_candidate_instructions [1]) ->meta_instruction->id) == 
pvm_meta_instruction_id_drop)
#line 5644
&& (#line 5639 "../../libpoke/pvm.jitter" 1)
  ) {
  {
  }
  { jitter_destroy_last_instructions (jitter_mutable_routine_p, 
jitter_head_instruction_no);
#line 5640 "../../libpoke/pvm.jitter"
    do { jitter_mutable_routine_append_meta_instruction 
((jitter_mutable_routine_p), pvm_meta_instructions + pvm_meta_instruction_id_nip
); } while (0);

  }
  {
  } return; }
}
-------------------------------------------------------------------------------

which is evidently unparseable.

Here is a proposed fix.

Attachment: 0003-Don-t-generate-line-preprocessor-directives-inside-C.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]