asan_c_args = ['-DBUILT_WITH_ASAN=0']
endif
+yacc_is_bison = true
+
if build_machine.system() == 'windows'
# Prefer the winflexbison versions, they're much easier to install and have
# better windows support.
prog_bison = find_program('bison', 'yacc', required : with_any_opengl)
endif
else
- prog_bison = find_program('bison', required : with_any_opengl)
+ prog_bison = find_program('bison', required : false)
+
+ if not prog_bison.found()
+ prog_bison = find_program('byacc', required : with_any_opengl)
+ yacc_is_bison = false
+ endif
# Disable deprecated keyword warnings, since we have to use them for
# old-bison compat. See discussion in
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
+bison_command = []
+if yacc_is_bison
+ bison_command = [
+ prog_bison, '-o', '@OUTPUT0@', '-p', 'glcpp_parser_',
+ '--defines=@OUTPUT1@', '@INPUT@',
+ ]
+else
+ bison_command = [
+ prog_bison, '-o', '@OUTPUT0@', '-p', 'glcpp_parser_',
+ '-H', '@OUTPUT1@', '@INPUT@',
+ ]
+endif
+
glcpp_parse = custom_target(
'glcpp-parse.[ch]',
input : 'glcpp-parse.y',
output : ['glcpp-parse.c', 'glcpp-parse.h'],
- command : [
- prog_bison, '-o', '@OUTPUT0@', '-p', 'glcpp_parser_',
- '--defines=@OUTPUT1@', '@INPUT@',
- ],
+ command : bison_command
)
glcpp_lex = custom_target(
subdir('glcpp')
+bison_command = []
+if yacc_is_bison
+ bison_command = [
+ prog_bison, '-o', '@OUTPUT0@', '-p', '_mesa_glsl_', '--defines=@OUTPUT1@',
+ '@INPUT@',
+ ]
+else
+ bison_command = [
+ prog_bison, '-o', '@OUTPUT0@', '-p', '_mesa_glsl_', '-H', '@OUTPUT1@',
+ '@INPUT@',
+ ]
+endif
+
glsl_parser = custom_target(
'glsl_parser',
input : 'glsl_parser.yy',
output : ['glsl_parser.cpp', 'glsl_parser.h'],
- command : [
- prog_bison, '-o', '@OUTPUT0@', '-p', '_mesa_glsl_', '--defines=@OUTPUT1@',
- '@INPUT@',
- ],
+ command : bison_command
)
glsl_lexer_cpp = custom_target(
/* glibc < 2.27 defines OVERFLOW in /usr/include/math.h. */
#undef OVERFLOW
-void yyerror (char *);
int yyparse(void);
int yylex(void);
char *lex_text(void);
#include <strings.h>
#include "i965_asm.h"
+#undef yyerror
+#ifdef YYBYACC
+struct YYLTYPE;
+void yyerror (struct YYLTYPE *, char *);
+#else
+void yyerror (char *);
+#endif
+
#undef ALIGN16
#define YYLTYPE YYLTYPE
%token <llint> LONG
%token NULL_TOKEN
-%precedence SUBREGNUM
+%nonassoc SUBREGNUM
%left PLUS MINUS
-%precedence DOT
-%precedence EMPTYEXECSIZE
-%precedence LPAREN
+%nonassoc DOT
+%nonassoc EMPTYEXECSIZE
+%nonassoc LPAREN
%type <integer> execsize simple_int exp
%type <llint> exp2
rellocation:
relativelocation
- | %empty { $$ = 0; }
+ | /* empty */ { $$ = 0; }
;
relativelocation:
jumplabel:
JUMP_LABEL { $$ = $1; }
- | %empty { $$ = NULL; }
+ | /* empty */ { $$ = NULL; }
;
jumplabeltarget:
subregnum:
DOT exp { $$ = $2; }
- | %empty %prec SUBREGNUM { $$ = 0; }
+ | /* empty */ %prec SUBREGNUM { $$ = 0; }
;
directgenreg:
/* Regions */
dstregion:
- %empty
+ /* empty */
{
$$ = BRW_HORIZONTAL_STRIDE_1;
}
;
region:
- %empty
+ /* empty */
{
$$ = stride($$, 0, 1, 0);
}
;
writemask:
- %empty
+ /* empty */
{
$$ = WRITEMASK_XYZW;
}
;
writemask_x:
- %empty { $$ = 0; }
+ /* empty */ { $$ = 0; }
| X { $$ = 1 << BRW_CHANNEL_X; }
;
writemask_y:
- %empty { $$ = 0; }
+ /* empty */ { $$ = 0; }
| Y { $$ = 1 << BRW_CHANNEL_Y; }
;
writemask_z:
- %empty { $$ = 0; }
+ /* empty */ { $$ = 0; }
| Z { $$ = 1 << BRW_CHANNEL_Z; }
;
writemask_w:
- %empty { $$ = 0; }
+ /* empty */ { $$ = 0; }
| W { $$ = 1 << BRW_CHANNEL_W; }
;
swizzle:
- %empty
+ /* empty */
{
$$ = BRW_SWIZZLE_NOOP;
}
/* Instruction prediction and modifiers */
predicate:
- %empty
+ /* empty */
{
brw_push_insn_state(p);
brw_set_default_predicate_control(p, BRW_PREDICATE_NONE);
;
predstate:
- %empty { $$ = 0; }
+ /* empty */ { $$ = 0; }
| PLUS { $$ = 0; }
| MINUS { $$ = 1; }
;
predctrl:
- %empty { $$ = BRW_PREDICATE_NORMAL; }
+ /* empty */ { $$ = BRW_PREDICATE_NORMAL; }
| DOT X { $$ = BRW_PREDICATE_ALIGN16_REPLICATE_X; }
| DOT Y { $$ = BRW_PREDICATE_ALIGN16_REPLICATE_Y; }
| DOT Z { $$ = BRW_PREDICATE_ALIGN16_REPLICATE_Z; }
/* Source Modification */
negate:
- %empty { $$ = 0; }
+ /* empty */ { $$ = 0; }
| MINUS { $$ = 1; }
;
abs:
- %empty { $$ = 0; }
+ /* empty */ { $$ = 0; }
| ABS { $$ = 1; }
;
;
condModifiers:
- %empty { $$ = BRW_CONDITIONAL_NONE; }
+ /* empty */ { $$ = BRW_CONDITIONAL_NONE; }
| ZERO
| EQUAL
| NOT_ZERO
;
saturate:
- %empty { $$ = BRW_INSTRUCTION_NORMAL; }
+ /* empty */ { $$ = BRW_INSTRUCTION_NORMAL; }
| SATURATE { $$ = BRW_INSTRUCTION_SATURATE; }
;
/* Execution size */
execsize:
- %empty %prec EMPTYEXECSIZE
+ /* empty */ %prec EMPTYEXECSIZE
{
$$ = 0;
}
/* Instruction options */
instoptions:
- %empty
+ /* empty */
{
memset(&$$, 0, sizeof($$));
}
$$ = $1;
add_instruction_option(&$$, $2);
}
- | %empty
+ | /* empty */
{
memset(&$$, 0, sizeof($$));
}
extern int yylineno;
+#ifdef YYBYACC
+void
+yyerror(YYLTYPE *ltype, char *msg)
+#else
void
yyerror(char *msg)
+#endif
{
fprintf(stderr, "%s: %d: %s at \"%s\"\n",
input_filename, yylineno, msg, lex_text());
)
endif
+bison_command = []
+if yacc_is_bison
+ bison_command = [
+ prog_bison, '@INPUT@', '--defines=@OUTPUT1@',
+ '--output=@OUTPUT0@'
+ ]
+else
+ bison_command = [
+ prog_bison, '-H', '@OUTPUT1@',
+ '-o', '@OUTPUT0@', '@INPUT@'
+ ]
+endif
+
i965_gram_tab = custom_target(
'i965_gram.tab.[ch]',
input : 'i965_gram.y',
output : ['i965_gram.tab.c', 'i965_gram.tab.h'],
- command : [
- prog_bison, '@INPUT@', '--defines=@OUTPUT1@',
- '--output=@OUTPUT0@'
- ]
+ command : bison_command
)
i965_lex_yy_c = custom_target(
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
+bison_command = []
+if yacc_is_bison
+ bison_command = [prog_bison, '-o', '@OUTPUT0@', '--defines=@OUTPUT1@', '@INPUT@']
+else
+ bison_command = [prog_bison, '-o', '@OUTPUT0@', '-H', '@OUTPUT1@', '@INPUT@']
+endif
+
mesa_lex = custom_target(
'mesa_lex',
input : 'program_lexer.l',
'program_parse_tab.[ch]',
input : 'program_parse.y',
output : ['program_parse.tab.c', 'program_parse.tab.h'],
- command : [prog_bison, '-o', '@OUTPUT0@', '--defines=@OUTPUT1@', '@INPUT@'],
+ command : bison_command,
)