diff --git a/contrib/cube/cubescan.l b/contrib/cube/cubescan.l
index eb71b11adffd64bfe52bc5c3a4b3acb4ea5fcd2a..c1849301585aad1f1c021c52e5ddd1e91d9f5616 100644
--- a/contrib/cube/cubescan.l
+++ b/contrib/cube/cubescan.l
@@ -32,6 +32,7 @@ void cube_scanner_finish(void);
 %option noinput
 %option nounput
 %option noyywrap
+%option warn
 %option prefix="cube_yy"
 
 
diff --git a/contrib/seg/segscan.l b/contrib/seg/segscan.l
index c2b5ca878962e26f4f31d131180fdcc5226a5165..e4feab39b379840ba24433342c3ba6350d106142 100644
--- a/contrib/seg/segscan.l
+++ b/contrib/seg/segscan.l
@@ -30,6 +30,7 @@ void seg_scanner_finish(void);
 %option noinput
 %option nounput
 %option noyywrap
+%option warn
 %option prefix="seg_yy"
 
 
diff --git a/src/backend/bootstrap/bootscanner.l b/src/backend/bootstrap/bootscanner.l
index fba020008fea989fd206cef8838c907c2e37c647..f4230d93b188285245fdb6bdd4e31fa7ddd7df7a 100644
--- a/src/backend/bootstrap/bootscanner.l
+++ b/src/backend/bootstrap/bootscanner.l
@@ -55,6 +55,7 @@ static int	yyline = 1;			/* line number for error reporting */
 %option noinput
 %option nounput
 %option noyywrap
+%option warn
 %option prefix="boot_yy"
 
 
diff --git a/src/backend/utils/misc/guc-file.l b/src/backend/utils/misc/guc-file.l
index 3e9b10328d480b47dce5240d74577fdc7b715885..70abf40a28e49c4abf9481ce7b27cec34f761ff6 100644
--- a/src/backend/utils/misc/guc-file.l
+++ b/src/backend/utils/misc/guc-file.l
@@ -51,6 +51,7 @@ static char *GUC_scanstr(const char *s);
 %option noinput
 %option nounput
 %option noyywrap
+%option warn
 %option prefix="GUC_yy"
 
 
diff --git a/src/bin/psql/psqlscan.l b/src/bin/psql/psqlscan.l
index dfc6648e569427dc895e9800522e984da6f20239..46141f7ddac584c24368f2e8e2cef5e6c8d80374 100644
--- a/src/bin/psql/psqlscan.l
+++ b/src/bin/psql/psqlscan.l
@@ -132,6 +132,7 @@ static void escape_variable(bool as_ident);
 %option noinput
 %option nounput
 %option noyywrap
+%option warn
 
 /*
  * All of the following definitions and rules should exactly match
diff --git a/src/interfaces/ecpg/preproc/pgc.l b/src/interfaces/ecpg/preproc/pgc.l
index 019b70bbaf931df48151f6e35ffe07a8a693ff70..e4f55f81768778ee95f02984b3cdee7cb2789dfb 100644
--- a/src/interfaces/ecpg/preproc/pgc.l
+++ b/src/interfaces/ecpg/preproc/pgc.l
@@ -84,6 +84,7 @@ static struct _if_value
 %option nodefault
 %option noinput
 %option noyywrap
+%option warn
 
 %option yylineno
 
diff --git a/src/test/isolation/specscanner.l b/src/test/isolation/specscanner.l
index 36e10e7678572622669708b5b20f17b6c9ecbad9..77d863e3e67b7d64ea65c626e0e68fe373119dcb 100644
--- a/src/test/isolation/specscanner.l
+++ b/src/test/isolation/specscanner.l
@@ -15,7 +15,7 @@ static int	yyline = 1;			/* line number for error reporting */
 static char litbuf[1024];
 static int litbufpos = 0;
 
-static void addlitchar(const char c);
+static void addlitchar(char c);
 
 %}
 
@@ -25,6 +25,7 @@ static void addlitchar(const char c);
 %option noinput
 %option nounput
 %option noyywrap
+%option warn
 %option prefix="spec_yy"
 
 
@@ -93,7 +94,7 @@ teardown		{ return(TEARDOWN); }
 %%
 
 static void
-addlitchar(const char c)
+addlitchar(char c)
 {
   if (litbufpos >= sizeof(litbuf) - 1)
   {