Branch: Tag:

2018-02-12

2018-02-12 10:37:06 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler: Added Pike 8.0 compat for is_const() change.

581:    Pike_compiler->current_modifiers & ~ID_EXTERN);    }    } else { -  if(!is_const($3)) { +  int warn = 0; +  if(!is_const($3) && !(warn = (TEST_COMPAT(8, 0) && is_const_80($3)))) {    if (Pike_compiler->compiler_pass == COMPILER_PASS_LAST) { -  yyerror("Constant definition is not constant."); +  int save_l_flag = l_flag; +  l_flag = 10; +  fputs("expr: ", stderr); +  print_tree($3); +  fputs("\n\n", stderr); +  l_flag = save_l_flag; +  my_yyerror("Constant definition is not constant: 0x%08x.", +  $3?$3->tree_info:0);    }    add_constant($1->u.sval.u.string, 0,    Pike_compiler->current_modifiers & ~ID_EXTERN);    } else {    if(!Pike_compiler->num_parse_error)    { -  ptrdiff_t tmp=eval_low($3,1); +  ptrdiff_t tmp; +  if (warn) { +  yywarning("Constant expression has external dependencies."); +  } +  tmp = eval_low($3,1);    if(tmp < 1)    {    yyerror("Error in constant definition.");
1867:   local_constant_name: TOK_IDENTIFIER '=' safe_expr0    {    struct pike_type *type; +  int warn = 0;       /* Ugly hack to make sure that $3 is optimized */    {
1877:    type=$3->u.node.a->type;    }    -  if(!is_const($3)) +  if(!is_const($3) && !(warn = (TEST_COMPAT(8, 0) && is_const_80($3))))    {    if(Pike_compiler->compiler_pass == COMPILER_PASS_LAST) -  yyerror("Constant definition is not constant."); +  my_yyerror("Constant definition is not constant: 0x%08x.", +  $3?$3->tree_info:0);    }else{ -  ptrdiff_t tmp=eval_low($3,1); +  ptrdiff_t tmp; +  if (warn) { +  yywarning("Constant expression has external dependencies."); +  } +  tmp = eval_low($3,1);    if(tmp < 1)    {    yyerror("Error in constant definition.");
2924:    {    if ($1) {    if ($2) { +  int warn = 0;    /* Explicit enum value. */       /* This can be made more lenient in the future */
2935:    Pike_compiler->compiler_pass=tmp;    }    -  if(!is_const($2)) +  if(!is_const($2) && !(warn = (TEST_COMPAT(8, 0) && is_const_80($2))))    {    if(Pike_compiler->compiler_pass == COMPILER_PASS_LAST)    yyerror("Enum definition is not constant.");
2943:    } else {    if(!Pike_compiler->num_parse_error)    { -  ptrdiff_t tmp=eval_low($2,1); +  ptrdiff_t tmp; +  if (warn) { +  yywarning("Constant expression has external dependencies."); +  } +  tmp = eval_low($2,1);    if(tmp < 1)    {    yyerror("Error in enum definition.");