Around 2012-07-07 00:45 UTC, I pulled master commit 2758492 and tried
to build on ubuntu-natty (11.04), which has gcc version 4.5.2.  The
gcc compiles downstream from files cfglex.l, xrmlex.l, and srclex.l in
l10ntools/source/ each failed with the message

    error: unknown option after ‘#pragma GCC diagnostic’ kind

Each time, the offending line was

    #pragma GCC diagnostic ignored "-Wunused-but-set-variable"


Taking a hint from <https://lkml.org/lkml/2011/7/26/488>, I
conditioned the three lines by

    #if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))

which allows a successful build.  I attach a patch, just in case this
situation of interest and this is the right solution; my blanket
licence statement is on file.


My setup of gedit also removed trailing spaces from two lines in each
of srclex.l and xrmlex.l.  I understand that trailing spaces are
generally not wanted, so I am not trying to fix this accident.


<aside>
  After I changed the three .l files, the build system picked up the
  changes without any "clean".  So I am left wondering how my build of
  master commit 96caa3b (2012-06-07) succeeded after the offending
  #pragma was added to cfglex.l on 2012-05-02.  Ah well, nowhere is it
  written that I shall understand everything.
</aside>

>From 37c3004e4c95433aa63a53295e93d181e432d11e Mon Sep 17 00:00:00 2001
From: Terrence Enger <ten...@iseries-guru.com>
Date: Sat, 7 Jul 2012 11:32:52 -0400
Subject: [PATCH] "Wunused-but-set-variable" was new in gcc 4.6

Condition new #pragma by gcc version

Change-Id: I0e5273c267e3514529de90d79cc221b44dbdcf9c
---
 l10ntools/source/cfglex.l |    2 ++
 l10ntools/source/srclex.l |    6 ++++--
 l10ntools/source/xrmlex.l |    6 ++++--
 3 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/l10ntools/source/cfglex.l b/l10ntools/source/cfglex.l
index dda0246..7476cbf 100644
--- a/l10ntools/source/cfglex.l
+++ b/l10ntools/source/cfglex.l
@@ -27,6 +27,8 @@
 #if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 2))
 #pragma GCC diagnostic ignored "-Wunused-function"
 #pragma GCC diagnostic ignored "-Wunused-label"
+#endif
+#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
 #pragma GCC diagnostic ignored "-Wunused-but-set-variable"
 #endif
 #elif defined __SINPRO_CC
diff --git a/l10ntools/source/srclex.l b/l10ntools/source/srclex.l
index 6001725..2fbd3f0 100644
--- a/l10ntools/source/srclex.l
+++ b/l10ntools/source/srclex.l
@@ -28,6 +28,8 @@
 #if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 2))
 #pragma GCC diagnostic ignored "-Wunused-function"
 #pragma GCC diagnostic ignored "-Wunused-label"
+#endif
+#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
 #pragma GCC diagnostic ignored "-Wunused-but-set-variable"
 #endif
 #elif defined __SINPRO_CC
@@ -154,8 +156,8 @@ void YYWarning();
 	WorkOnTokenSet( TEXTREFID, yytext );
 }
 
-[a-zA-Z0-9_]+[ \t]*"="[\t ]*([ \t]*"//".*\n)*.*	| 
-[a-zA-Z0-9_]+[ \t]*"=".*	{ 
+[a-zA-Z0-9_]+[ \t]*"="[\t ]*([ \t]*"//".*\n)*.*	|
+[a-zA-Z0-9_]+[ \t]*"=".*	{
 /* ASSIGNMENT  Typ = ...  */
  WorkOnTokenSet( ASSIGNMENT, yytext );
 }
diff --git a/l10ntools/source/xrmlex.l b/l10ntools/source/xrmlex.l
index 5e00cc1..9e9aa5c 100644
--- a/l10ntools/source/xrmlex.l
+++ b/l10ntools/source/xrmlex.l
@@ -17,7 +17,7 @@
 #endif
 
 /* table of possible token ids */
-#include "tokens.h"                          
+#include "tokens.h"
 #include <stdlib.h>
 #include <stdio.h>
 
@@ -27,6 +27,8 @@
 #if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 2))
 #pragma GCC diagnostic ignored "-Wunused-function"
 #pragma GCC diagnostic ignored "-Wunused-label"
+#endif
+#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
 #pragma GCC diagnostic ignored "-Wunused-but-set-variable"
 #endif
 #elif defined __SINPRO_CC
@@ -154,7 +156,7 @@ int bText=0;
 		c2 = c3;
 		c3 = yyinput();
 		pChar[0] = c3;
-		WorkOnTokenSet( COMMEND, pChar );                          
+		WorkOnTokenSet( COMMEND, pChar );
 	}
 }
 
-- 
1.7.4.1

_______________________________________________
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice

Reply via email to