Commit ad210790 authored by Brad King's avatar Brad King

Fortran: Follow <>-style includes (#13239)

Fortran sources that pass through the C preprocessor may use

 #include "header"

syntax or

 #include <header>

syntax.  CMake already follows the former.  Teach it to follow the
latter.
parent f2656e4c
This diff is collapsed.
......@@ -20,7 +20,7 @@
#define FLEX_SCANNER
#define YY_FLEX_MAJOR_VERSION 2
#define YY_FLEX_MINOR_VERSION 5
#define YY_FLEX_SUBMINOR_VERSION 34
#define YY_FLEX_SUBMINOR_VERSION 35
#if YY_FLEX_SUBMINOR_VERSION > 0
#define FLEX_BETA
#endif
......@@ -65,7 +65,6 @@ typedef int flex_int32_t;
typedef unsigned char flex_uint8_t;
typedef unsigned short int flex_uint16_t;
typedef unsigned int flex_uint32_t;
#endif /* ! C99 */
/* Limits of integral types. */
#ifndef INT8_MIN
......@@ -96,6 +95,8 @@ typedef unsigned int flex_uint32_t;
#define UINT32_MAX (4294967295U)
#endif
#endif /* ! C99 */
#endif /* ! FLEXINT_H */
#ifdef __cplusplus
......@@ -138,7 +139,15 @@ typedef void* yyscan_t;
/* Size of default input buffer. */
#ifndef YY_BUF_SIZE
#ifdef __ia64__
/* On IA-64, the buffer size is 16k, not 8k.
* Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
* Ditto for the __ia64__ case accordingly.
*/
#define YY_BUF_SIZE 32768
#else
#define YY_BUF_SIZE 16384
#endif /* __ia64__ */
#endif
#ifndef YY_TYPEDEF_YY_BUFFER_STATE
......@@ -146,13 +155,6 @@ typedef void* yyscan_t;
typedef struct yy_buffer_state *YY_BUFFER_STATE;
#endif
/* The following is because we cannot portably get our hands on size_t
* (without autoconf's help, which isn't available because we want
* flex-generated scanners to compile on their own).
* Given that the standard has decreed that size_t exists since 1989,
* I guess we can afford to depend on it. Manoj.
*/
#ifndef YY_TYPEDEF_YY_SIZE_T
#define YY_TYPEDEF_YY_SIZE_T
typedef size_t yy_size_t;
......@@ -304,7 +306,12 @@ static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner);
/* Amount of stuff to slurp up with each read. */
#ifndef YY_READ_BUF_SIZE
#ifdef __ia64__
/* On IA-64, the buffer size is 16k, not 8k */
#define YY_READ_BUF_SIZE 16384
#else
#define YY_READ_BUF_SIZE 8192
#endif /* __ia64__ */
#endif
/* Number of entries by which start-condition stack grows. */
......
......@@ -115,6 +115,11 @@ Modify cmDependsFortranLexer.h:
!.*\n { return EOSTMT; } /* Treat comments like */
<fixed_fmt>^[cC*dD].*\n { return EOSTMT; } /* empty lines */
^[ \t]*#[ \t]*include[ \t]*<[^>]+> {
yytext[yyleng-1] = 0;
yylvalp->string = strdup(strchr(yytext, '<')+1);
return CPP_INCLUDE_ANGLE;
}
^[ \t]*#[ \t]*include { return CPP_INCLUDE; }
\$[ \t]*include { return F90PPR_INCLUDE; }
\?\?[ \t]*include { return COCO_INCLUDE; }
......
This diff is collapsed.
......@@ -102,6 +102,7 @@ static bool cmDependsFortranParserIsKeyword(const char* word,
%token <string> CPP_TOENDL
%token <number> UNTERMINATED_STRING
%token <string> STRING WORD
%token <string> CPP_INCLUDE_ANGLE
/*-------------------------------------------------------------------------*/
/* grammar */
......@@ -192,6 +193,13 @@ keyword_stmt:
free($1);
free($2);
}
| CPP_INCLUDE_ANGLE other EOSTMT
{
cmDependsFortranParser* parser =
cmDependsFortran_yyget_extra(yyscanner);
cmDependsFortranParser_RuleInclude(parser, $1);
free($1);
}
| include STRING other EOSTMT
{
cmDependsFortranParser* parser =
......
/* A Bison parser, made by GNU Bison 2.4.1. */
/* A Bison parser, made by GNU Bison 2.5. */
/* Skeleton interface for Bison's Yacc-like parsers in C
/* Bison interface for Yacc-like parsers in C
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc.
Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......@@ -31,6 +30,7 @@
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
/* Tokens. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
......@@ -64,7 +64,8 @@
CPP_TOENDL = 282,
UNTERMINATED_STRING = 283,
STRING = 284,
WORD = 285
WORD = 285,
CPP_INCLUDE_ANGLE = 286
};
#endif
/* Tokens. */
......@@ -96,6 +97,7 @@
#define UNTERMINATED_STRING 283
#define STRING 284
#define WORD 285
#define CPP_INCLUDE_ANGLE 286
......@@ -104,12 +106,14 @@
typedef union YYSTYPE
{
/* Line 1676 of yacc.c */
#line 94 "cmDependsFortranParser.y"
/* Line 2068 of yacc.c */
#line 89 "cmDependsFortranParser.y"
char* string;
/* Line 1676 of yacc.c */
/* Line 2068 of yacc.c */
#line 118 "cmDependsFortranParserTokens.h"
} YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment