Source: graywolf
Version: 0.1.4+20170307gite1bf319-1
Severity: normal
Tags: patch upstream

Hi,
I noticed that this currently fails to build on kFreeBSD and Hurd, since
it tries to use stdin in an initializer list, which gives an error
(stdin is not a compile-time constant). There is already code to work
around this on Linux, so I'm not sure why it's not used elsewhere, but
the attached patch fixes the build for me on kfreebsd-amd64 (I assume
kfreebsd-i386 and hurd-i386 too, though I have not actually tested
that). It also removes the strange stdio.h handling, which isn't
necessary, but is even more mind-boggling.

Regards,
James
Description: Fix FTBFS on non-Linux since stdin is not a constant
Author: James Clarke <jrt...@jrtc27.com>
Last-Update: 2017-03-07
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/src/mc_compact/readcgraph_l.h
+++ b/src/mc_compact/readcgraph_l.h
@@ -1,8 +1,4 @@
-#ifdef linux
 #include <stdio.h>
-#else
-# include "stdio.h"
-#endif
 #include <yalecad/string.h>
 # define U(x) ((x)&0377)
 # define NLSTATE yyprevious=YYNEWLINE
@@ -22,11 +18,7 @@ int yyleng; extern char yytext[];
 int yymorfg;
 extern char *yysptr, yysbuf[];
 int yytchar;
-#ifdef linux
 FILE *yyin = NULL, *yyout = NULL;
-#else
-FILE *yyin ={stdin}, *yyout ={stdout};
-#endif
 extern int yylineno;
 struct yysvf { 
 	struct yywork *yystoff;
@@ -461,10 +453,8 @@ yylook(){
 	int debug;
 # endif
 	char *yylastch;
-#ifdef linux
 	if (yyin == NULL) yyin = stdin;
 	if (yyout == NULL) yyout = stdout;
-#endif
 	/* start off machines */
 # ifdef LEXDEBUG
 	debug = 0;
@@ -614,16 +604,12 @@ return(0);
 }
 	/* the following are only used in the lex library */
 yyinput(){
-#ifdef linux
 	if (yyin == NULL) yyin = stdin;
-#endif
 	return(input());
 	}
 yyoutput(c)
   int c; {
-#ifdef linux
 	if (yyout == NULL) yyout = stdout;
-#endif
 	output(c);
 	}
 yyunput(c)
--- a/src/mc_compact/readtiles_l.h
+++ b/src/mc_compact/readtiles_l.h
@@ -1,8 +1,4 @@
-#ifdef linux
 #include <stdio.h>
-#else
-# include "stdio.h"
-#endif
 #include <yalecad/string.h>
 # define U(x) ((x)&0377)
 # define NLSTATE yyprevious=YYNEWLINE
@@ -22,11 +18,7 @@ int yyleng; extern char yytext[];
 int yymorfg;
 extern char *yysptr, yysbuf[];
 int yytchar;
-#ifdef linux
 FILE *yyin = NULL, *yyout = NULL;
-#else
-FILE *yyin ={stdin}, *yyout ={stdout};
-#endif
 extern int yylineno;
 struct yysvf { 
 	struct yywork *yystoff;
@@ -516,10 +508,8 @@ yylook(){
 	int debug;
 # endif
 	char *yylastch;
-#ifdef linux
 	if (yyin == NULL) yyin = stdin;
 	if (yyout == NULL) yyout = stdout;
-#endif
 	/* start off machines */
 # ifdef LEXDEBUG
 	debug = 0;
@@ -669,16 +659,12 @@ return(0);
 }
 	/* the following are only used in the lex library */
 yyinput(){
-#ifdef linux
 	if (yyin == NULL) yyin = stdin;
-#endif
 	return(input());
 	}
 yyoutput(c)
   int c; {
-#ifdef linux
 	if (yyout == NULL) yyout = stdout;
-#endif
 	output(c);
 	}
 yyunput(c)
--- a/src/mincut/readcells_l.h
+++ b/src/mincut/readcells_l.h
@@ -1,8 +1,4 @@
-#ifdef linux
 #include <stdio.h>
-#else
-# include "stdio.h"
-#endif
 # define U(x) ((x)&0377)
 # define NLSTATE yyprevious=YYNEWLINE
 # define BEGIN yybgin = yysvec + 1 +
@@ -21,11 +17,7 @@ int yyleng; extern char yytext[];
 int yymorfg;
 extern char *yysptr, yysbuf[];
 int yytchar;
-#ifdef linux
 FILE *yyin =(FILE *)NULL, *yyout =(FILE *)NULL;
-#else
-FILE *yyin ={stdin}, *yyout ={stdout};
-#endif
 extern int yylineno;
 struct yysvf { 
 	struct yywork *yystoff;
@@ -541,10 +533,8 @@ yylook(){
 	int debug;
 # endif
 	char *yylastch;
-#ifdef linux
 	if (yyin == NULL) yyin = stdin;
 	if (yyout == NULL) yyout = stdout;
-#endif
 	/* start off machines */
 # ifdef LEXDEBUG
 	debug = 0;
@@ -694,16 +684,12 @@ return(0);
 }
 	/* the following are only used in the lex library */
 yyinput(){
-#ifdef linux
 	if (yyin == NULL) yyin = stdin;
-#endif
 	return(input());
 	}
 yyoutput(c)
   int c; {
-#ifdef linux
 	if (yyout == NULL) yyout = stdout;
-#endif
 	output(c);
 	}
 yyunput(c)
--- a/src/syntax/readcells_l.h
+++ b/src/syntax/readcells_l.h
@@ -1,8 +1,4 @@
-#ifdef linux
 #include <stdio.h>
-#else
-# include "stdio.h"
-#endif
 # define U(x) ((x)&0377)
 # define NLSTATE yyprevious=YYNEWLINE
 # define BEGIN yybgin = yysvec + 1 +
@@ -21,11 +17,7 @@ int yyleng; extern char yytext[];
 int yymorfg;
 extern char *yysptr, yysbuf[];
 int yytchar;
-#ifdef linux
 FILE *yyin = NULL, *yyout = NULL;
-#else
-FILE *yyin ={stdin}, *yyout ={stdout};
-#endif
 extern int yylineno;
 struct yysvf { 
 	struct yywork *yystoff;
@@ -541,10 +533,8 @@ yylook(){
 	int debug;
 # endif
 	char *yylastch;
-#ifdef linux
 	if (yyin == NULL) yyin = stdin;
 	if (yyout == NULL) yyout = stdout;
-#endif
 	/* start off machines */
 # ifdef LEXDEBUG
 	debug = 0;
@@ -694,16 +684,12 @@ return(0);
 }
 	/* the following are only used in the lex library */
 yyinput(){
-#ifdef linux
 	if (yyin == NULL) yyin = stdin;
-#endif
 	return(input());
 	}
 yyoutput(c)
   int c; {
-#ifdef linux
 	if (yyout == NULL) yyout = stdout;
-#endif
 	output(c);
 	}
 yyunput(c)
--- a/src/twflow/readobjects_l.h
+++ b/src/twflow/readobjects_l.h
@@ -1,8 +1,4 @@
-#ifdef linux
-# include <stdio.h>
-#else
-# include "stdio.h"
-#endif
+#include <stdio.h>
 # define U(x) ((x)&0377)
 # define NLSTATE yyprevious=YYNEWLINE
 # define BEGIN yybgin = yysvec + 1 +
@@ -21,11 +17,7 @@ int yyleng; extern char yytext[];
 int yymorfg;
 extern char *yysptr, yysbuf[];
 int yytchar;
-#ifdef linux
 FILE *yyin =NULL, *yyout =NULL;
-#else
-FILE *yyin ={stdin}, *yyout ={stdout};
-#endif
 extern int yylineno;
 struct yysvf { 
 	struct yywork *yystoff;
@@ -511,10 +503,8 @@ yylook(){
 	int debug;
 # endif
 	char *yylastch;
-#ifdef linux
 	if (yyin == NULL) yyin = stdin;
 	if (yyout == NULL) yyout = stdout;
-#endif
 	/* start off machines */
 # ifdef LEXDEBUG
 	debug = 0;
@@ -664,16 +654,12 @@ return(0);
 }
 	/* the following are only used in the lex library */
 yyinput(){
-#ifdef linux
 	if (yyin == NULL) yyin = stdin;
-#endif
 	return(input());
 	}
 yyoutput(c)
   int c; {
-#ifdef linux
 	if (yyout == NULL) yyout = stdout;
-#endif
 	output(c);
 	}
 yyunput(c)
--- a/src/twmc/readcells_l.h
+++ b/src/twmc/readcells_l.h
@@ -1,8 +1,4 @@
-#ifdef linux
 #include <stdio.h>
-#else
-# include "stdio.h"
-#endif
 # define U(x) ((x)&0377)
 # define NLSTATE yyprevious=YYNEWLINE
 # define BEGIN yybgin = yysvec + 1 +
@@ -21,11 +17,7 @@ int yyleng; extern char yytext[];
 int yymorfg;
 extern char *yysptr, yysbuf[];
 int yytchar;
-#ifdef linux
 FILE *yyin =NULL, *yyout =NULL;
-#else
-FILE *yyin ={stdin}, *yyout ={stdout};
-#endif
 extern int yylineno;
 struct yysvf { 
 	struct yywork *yystoff;
@@ -527,10 +519,8 @@ yylook(){
 # endif
 	char *yylastch;
 	/* start off machines */
-#ifdef linux
 	if (yyin == NULL) yyin = stdin;
 	if (yyout == NULL) yyout = stdout;
-#endif
 # ifdef LEXDEBUG
 	debug = 0;
 # endif
@@ -679,16 +669,12 @@ return(0);
 }
 	/* the following are only used in the lex library */
 yyinput(){
-#ifdef linux
 	if (yyin == NULL) yyin = stdin;
-#endif
 	return(input());
 	}
 yyoutput(c)
   int c; {
-#ifdef linux
 	if (yyout == NULL) yyout = stdout;
-#endif
 	output(c);
 	}
 yyunput(c)
--- a/src/twmc/readnets_l.h
+++ b/src/twmc/readnets_l.h
@@ -1,8 +1,4 @@
-#ifdef linux
-# include <stdio.h>
-#else
-# include "stdio.h"
-#endif
+#include <stdio.h>
 # define U(x) ((x)&0377)
 # define NLSTATE yyprevious=YYNEWLINE
 # define BEGIN yybgin = yysvec + 1 +
@@ -21,11 +17,7 @@ int yyleng; extern char yytext[];
 int yymorfg;
 extern char *yysptr, yysbuf[];
 int yytchar;
-#ifdef linux
 FILE *yyin = NULL, *yyout = NULL;
-#else
-FILE *yyin ={stdin}, *yyout ={stdout};
-#endif
 extern int yylineno;
 struct yysvf { 
 	struct yywork *yystoff;
@@ -526,10 +518,8 @@ yylook(){
 	int debug;
 # endif
 	char *yylastch;
-#ifdef linux
 	if (yyin == NULL) yyin = stdin;
 	if (yyout == NULL) yyout = stdout;
-#endif
 	/* start off machines */
 # ifdef LEXDEBUG
 	debug = 0;
@@ -679,16 +669,12 @@ return(0);
 }
 	/* the following are only used in the lex library */
 yyinput(){
-#ifdef linux
 	if (yyin == NULL) yyin = stdin;
-#endif
 	return(input());
 	}
 yyoutput(c)
   int c; {
-#ifdef linux
 	if (yyout == NULL) yyout = stdout;
-#endif
 	output(c);
 	}
 yyunput(c)
--- a/src/twsc/readcell_l.h
+++ b/src/twsc/readcell_l.h
@@ -1,8 +1,4 @@
-#ifdef linux
-# include <stdio.h>
-#else
-# include "stdio.h"
-#endif
+#include <stdio.h>
 # define U(x) ((x)&0377)
 # define NLSTATE yyprevious=YYNEWLINE
 # define BEGIN yybgin = yysvec + 1 +
@@ -21,11 +17,7 @@ int yyleng; extern char yytext[];
 int yymorfg;
 extern char *yysptr, yysbuf[];
 int yytchar;
-#ifdef linux
 FILE *yyin = (FILE *)NULL, *yyout = (FILE *)NULL;
-#else
-FILE *yyin ={stdin}, *yyout ={stdout};
-#endif
 extern int yylineno;
 struct yysvf { 
 	struct yywork *yystoff;
@@ -531,10 +523,8 @@ yylook(){
 # endif
 	char *yylastch;
 
-#ifdef linux
 	if (yyin == (FILE *)NULL) yyin = stdin;
 	if (yyout == (FILE *)NULL) yyout = stdout;
-#endif
 	/* start off machines */
 # ifdef LEXDEBUG
 	debug = 0;
@@ -684,16 +674,12 @@ return(0);
 }
 	/* the following are only used in the lex library */
 yyinput(){
-#ifdef linux
 	if (yyin == NULL) yyin = stdin;
-#endif
 	return(input());
 	}
 yyoutput(c)
   int c; {
-#ifdef linux
 	if (yyout == NULL) yyout = stdout;
-#endif
 	output(c);
 	}
 yyunput(c)
--- a/src/twsc/readnets_l.h
+++ b/src/twsc/readnets_l.h
@@ -1,8 +1,4 @@
-#ifdef linux
-# include <stdio.h>
-#else
-# include "stdio.h"
-#endif
+#include <stdio.h>
 # define U(x) ((x)&0377)
 # define NLSTATE yyprevious=YYNEWLINE
 # define BEGIN yybgin = yysvec + 1 +
@@ -21,11 +17,7 @@ int yyleng; extern char yytext[];
 int yymorfg;
 extern char *yysptr, yysbuf[];
 int yytchar;
-#ifdef linux
 FILE *yyin =NULL, *yyout =NULL;
-#else
-FILE *yyin ={stdin}, *yyout ={stdout};
-#endif
 extern int yylineno;
 struct yysvf { 
 	struct yywork *yystoff;
@@ -489,10 +481,8 @@ yylook(){
 # endif
 	char *yylastch;
 	/* start off machines */
-#ifdef linux
 	if (yyin == NULL) yyin = stdin;
 	if (yyout == NULL) yyout = stdout;
-#endif
 # ifdef LEXDEBUG
 	debug = 0;
 # endif
@@ -641,16 +631,12 @@ return(0);
 }
 	/* the following are only used in the lex library */
 yyinput(){
-#ifdef linux
 	if (yyin == NULL) yyin = stdin;
-#endif
 	return(input());
 	}
 yyoutput(c)
   int c; {
-#ifdef linux
 	if (yyout == NULL) yyout = stdout;
-#endif
 	output(c);
 	}
 yyunput(c)
-- 
debian-science-maintainers mailing list
debian-science-maintainers@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/debian-science-maintainers

Reply via email to