r2636 - in glibc-package/branches/glibc-2.7/debian: . patches patches/locale
Author: madcoder
Date: 2007-10-29 21:08:44 +0000 (Mon, 29 Oct 2007)
New Revision: 2636
Modified:
glibc-package/branches/glibc-2.7/debian/changelog
glibc-package/branches/glibc-2.7/debian/patches/locale/preprocessor-collate-uli-sucks.diff
glibc-package/branches/glibc-2.7/debian/patches/locale/preprocessor-collate.diff
glibc-package/branches/glibc-2.7/debian/patches/series
Log:
Reinstate Denis patch
Signed-off-by: Pierre Habouzit <madcoder@debian.org>
Modified: glibc-package/branches/glibc-2.7/debian/changelog
===================================================================
--- glibc-package/branches/glibc-2.7/debian/changelog 2007-10-29 09:55:59 UTC (rev 2635)
+++ glibc-package/branches/glibc-2.7/debian/changelog 2007-10-29 21:08:44 UTC (rev 2636)
@@ -83,8 +83,9 @@
* Update any/submitted-rfc3484-sortv4.diff.
* Update localedata/*first_weekday.diff.
* Remove localedata/fix-am_ET.diff (obsolete).
- * Add locale/preprocessor-collate-uli-sucks.diff to fix endless loop when
- ifdef is used.
+ * Add locale/preprocessor-collate-uli-sucks.diff to revert Ulrich's
+ preprocessor that isn't enough for Debian.
+ * Update patches/locale/preprocessor-collate.diff.
-- Aurelien Jarno <aurel32@debian.org> Mon, 29 Oct 2007 10:54:31 +0100
Modified: glibc-package/branches/glibc-2.7/debian/patches/locale/preprocessor-collate-uli-sucks.diff
===================================================================
--- glibc-package/branches/glibc-2.7/debian/patches/locale/preprocessor-collate-uli-sucks.diff 2007-10-29 09:55:59 UTC (rev 2635)
+++ glibc-package/branches/glibc-2.7/debian/patches/locale/preprocessor-collate-uli-sucks.diff 2007-10-29 21:08:44 UTC (rev 2636)
@@ -1,11 +1,328 @@
--- locale/programs/ld-collate.c.orig
+++ locale/programs/ld-collate.c
-@@ -4034,6 +4034,8 @@
- arg->val.str.lenmb) == 0
- && curdef->str[arg->val.str.lenmb] == '\0')
- break;
-+ else
-+ curdef = curdef->next;
+@@ -181,14 +181,6 @@
+ #include "3level.h"
- if ((nowtok == tok_ifdef && curdef != NULL)
- || (nowtok == tok_ifndef && curdef == NULL))
+
+-/* Simple name list for the preprocessor. */
+-struct name_list
+-{
+- struct name_list *next;
+- char str[0];
+-};
+-
+-
+ /* The real definition of the struct for the LC_COLLATE locale. */
+ struct locale_collate_t
+ {
+@@ -248,15 +240,6 @@
+ /* The arrays with the collation sequence order. */
+ unsigned char mbseqorder[256];
+ struct collseq_table wcseqorder;
+-
+- /* State of the preprocessor. */
+- enum
+- {
+- else_none = 0,
+- else_ignore,
+- else_seen
+- }
+- else_action;
+ };
+
+
+@@ -264,9 +247,6 @@
+ LC_COLLATE category descriptions in all files. */
+ static uint32_t nrules;
+
+-/* List of defined preprocessor symbols. */
+-static struct name_list *defined;
+-
+
+ /* We need UTF-8 encoding of numbers. */
+ static inline int
+@@ -2653,46 +2633,6 @@
+ }
+
+
+-static enum token_t
+-skip_to (struct linereader *ldfile, struct locale_collate_t *collate,
+- const struct charmap_t *charmap, int to_endif)
+-{
+- while (1)
+- {
+- struct token *now = lr_token (ldfile, charmap, NULL, NULL, 0);
+- enum token_t nowtok = now->tok;
+-
+- if (nowtok == tok_eof || nowtok == tok_end)
+- return nowtok;
+-
+- if (nowtok == tok_ifdef || nowtok == tok_ifndef)
+- {
+- lr_error (ldfile, _("%s: nested conditionals not supported"),
+- "LC_COLLATE");
+- nowtok = skip_to (ldfile, collate, charmap, tok_endif);
+- if (nowtok == tok_eof || nowtok == tok_end)
+- return nowtok;
+- }
+- else if (nowtok == tok_endif || (!to_endif && nowtok == tok_else))
+- {
+- lr_ignore_rest (ldfile, 1);
+- return nowtok;
+- }
+- else if (!to_endif && (nowtok == tok_elifdef || nowtok == tok_elifndef))
+- {
+- /* Do not read the rest of the line. */
+- return nowtok;
+- }
+- else if (nowtok == tok_else)
+- {
+- lr_error (ldfile, _("%s: more then one 'else'"), "LC_COLLATE");
+- }
+-
+- lr_ignore_rest (ldfile, 0);
+- }
+-}
+-
+-
+ void
+ collate_read (struct linereader *ldfile, struct localedef_t *result,
+ const struct charmap_t *charmap, const char *repertoire_name,
+@@ -2723,8 +2663,6 @@
+ /* The rest of the line containing `LC_COLLATE' must be free. */
+ lr_ignore_rest (ldfile, 1);
+
+- while (1)
+- {
+ do
+ {
+ now = lr_token (ldfile, charmap, result, NULL, verbose);
+@@ -2732,31 +2670,6 @@
+ }
+ while (nowtok == tok_eol);
+
+- if (nowtok != tok_define)
+- break;
+-
+- if (ignore_content)
+- lr_ignore_rest (ldfile, 0);
+- else
+- {
+- arg = lr_token (ldfile, charmap, result, NULL, verbose);
+- if (arg->tok != tok_ident)
+- SYNTAX_ERROR (_("%s: syntax error"), "LC_COLLATE");
+- else
+- {
+- /* Simply add the new symbol. */
+- struct name_list *newsym = xmalloc (sizeof (*newsym)
+- + arg->val.str.lenmb + 1);
+- memcpy (newsym->str, arg->val.str.startmb, arg->val.str.lenmb);
+- newsym->str[arg->val.str.lenmb] = '\0';
+- newsym->next = defined;
+- defined = newsym;
+-
+- lr_ignore_rest (ldfile, 1);
+- }
+- }
+- }
+-
+ if (nowtok == tok_copy)
+ {
+ now = lr_token (ldfile, charmap, result, NULL, verbose);
+@@ -3911,7 +3824,6 @@
+ break;
+
+ case tok_end:
+- seen_end:
+ /* Next we assume `LC_COLLATE'. */
+ if (!ignore_content)
+ {
+@@ -3952,180 +3864,6 @@
+ lr_ignore_rest (ldfile, arg->tok == tok_lc_collate);
+ return;
+
+- case tok_define:
+- if (ignore_content)
+- {
+- lr_ignore_rest (ldfile, 0);
+- break;
+- }
+-
+- arg = lr_token (ldfile, charmap, result, NULL, verbose);
+- if (arg->tok != tok_ident)
+- goto err_label;
+-
+- /* Simply add the new symbol. */
+- struct name_list *newsym = xmalloc (sizeof (*newsym)
+- + arg->val.str.lenmb + 1);
+- memcpy (newsym->str, arg->val.str.startmb, arg->val.str.lenmb);
+- newsym->str[arg->val.str.lenmb] = '\0';
+- newsym->next = defined;
+- defined = newsym;
+-
+- lr_ignore_rest (ldfile, 1);
+- break;
+-
+- case tok_undef:
+- if (ignore_content)
+- {
+- lr_ignore_rest (ldfile, 0);
+- break;
+- }
+-
+- arg = lr_token (ldfile, charmap, result, NULL, verbose);
+- if (arg->tok != tok_ident)
+- goto err_label;
+-
+- /* Remove _all_ occurrences of the symbol from the list. */
+- struct name_list *prevdef = NULL;
+- struct name_list *curdef = defined;
+- while (curdef != NULL)
+- if (strncmp (arg->val.str.startmb, curdef->str,
+- arg->val.str.lenmb) == 0
+- && curdef->str[arg->val.str.lenmb] == '\0')
+- {
+- if (prevdef == NULL)
+- defined = curdef->next;
+- else
+- prevdef->next = curdef->next;
+-
+- struct name_list *olddef = curdef;
+- curdef = curdef->next;
+-
+- free (olddef);
+- }
+- else
+- {
+- prevdef = curdef;
+- curdef = curdef->next;
+- }
+-
+- lr_ignore_rest (ldfile, 1);
+- break;
+-
+- case tok_ifdef:
+- case tok_ifndef:
+- if (ignore_content)
+- {
+- lr_ignore_rest (ldfile, 0);
+- break;
+- }
+-
+- found_ifdef:
+- arg = lr_token (ldfile, charmap, result, NULL, verbose);
+- if (arg->tok != tok_ident)
+- goto err_label;
+- lr_ignore_rest (ldfile, 1);
+-
+- if (collate->else_action == else_none)
+- {
+- curdef = defined;
+- while (curdef != NULL)
+- if (strncmp (arg->val.str.startmb, curdef->str,
+- arg->val.str.lenmb) == 0
+- && curdef->str[arg->val.str.lenmb] == '\0')
+- break;
+-
+- if ((nowtok == tok_ifdef && curdef != NULL)
+- || (nowtok == tok_ifndef && curdef == NULL))
+- {
+- /* We have to use the if-branch. */
+- collate->else_action = else_ignore;
+- }
+- else
+- {
+- /* We have to use the else-branch, if there is one. */
+- nowtok = skip_to (ldfile, collate, charmap, 0);
+- if (nowtok == tok_else)
+- collate->else_action = else_seen;
+- else if (nowtok == tok_elifdef)
+- {
+- nowtok = tok_ifdef;
+- goto found_ifdef;
+- }
+- else if (nowtok == tok_elifndef)
+- {
+- nowtok = tok_ifndef;
+- goto found_ifdef;
+- }
+- else if (nowtok == tok_eof)
+- goto seen_eof;
+- else if (nowtok == tok_end)
+- goto seen_end;
+- }
+- }
+- else
+- {
+- /* XXX Should it really become necessary to support nested
+- preprocessor handling we will push the state here. */
+- lr_error (ldfile, _("%s: nested conditionals not supported"),
+- "LC_COLLATE");
+- nowtok = skip_to (ldfile, collate, charmap, 1);
+- if (nowtok == tok_eof)
+- goto seen_eof;
+- else if (nowtok == tok_end)
+- goto seen_end;
+- }
+- break;
+-
+- case tok_elifdef:
+- case tok_elifndef:
+- case tok_else:
+- if (ignore_content)
+- {
+- lr_ignore_rest (ldfile, 0);
+- break;
+- }
+-
+- lr_ignore_rest (ldfile, 1);
+-
+- if (collate->else_action == else_ignore)
+- {
+- /* Ignore everything until the endif. */
+- nowtok = skip_to (ldfile, collate, charmap, 1);
+- if (nowtok == tok_eof)
+- goto seen_eof;
+- else if (nowtok == tok_end)
+- goto seen_end;
+- }
+- else
+- {
+- assert (collate->else_action == else_none);
+- lr_error (ldfile, _("\
+-%s: '%s' without matching 'ifdef' or 'ifndef'"), "LC_COLLATE",
+- nowtok == tok_else ? "else"
+- : nowtok == tok_elifdef ? "elifdef" : "elifndef");
+- }
+- break;
+-
+- case tok_endif:
+- if (ignore_content)
+- {
+- lr_ignore_rest (ldfile, 0);
+- break;
+- }
+-
+- lr_ignore_rest (ldfile, 1);
+-
+- if (collate->else_action != else_ignore
+- && collate->else_action != else_seen)
+- lr_error (ldfile, _("\
+-%s: 'endif' without matching 'ifdef' or 'ifndef'"), "LC_COLLATE");
+-
+- /* XXX If we support nested preprocessor directives we pop
+- the state here. */
+- collate->else_action = else_none;
+- break;
+-
+ default:
+ err_label:
+ SYNTAX_ERROR (_("%s: syntax error"), "LC_COLLATE");
+@@ -4136,7 +3874,6 @@
+ nowtok = now->tok;
+ }
+
+- seen_eof:
+ /* When we come here we reached the end of the file. */
+ lr_error (ldfile, _("%s: premature end of file"), "LC_COLLATE");
+ }
Modified: glibc-package/branches/glibc-2.7/debian/patches/locale/preprocessor-collate.diff
===================================================================
--- glibc-package/branches/glibc-2.7/debian/patches/locale/preprocessor-collate.diff 2007-10-29 09:55:59 UTC (rev 2635)
+++ glibc-package/branches/glibc-2.7/debian/patches/locale/preprocessor-collate.diff 2007-10-29 21:08:44 UTC (rev 2636)
@@ -12,7 +12,7 @@
--- locale/programs/ld-collate.c.orig
+++ locale/programs/ld-collate.c
-@@ -159,6 +159,24 @@
+@@ -160,6 +160,24 @@
size_t line;
};
@@ -37,7 +37,7 @@
/* Sparse table of struct element_t *. */
#define TABLE wchead_table
#define ELEMENT struct element_t *
-@@ -212,6 +230,9 @@
+@@ -213,6 +231,9 @@
/* This value is used when handling ellipsis. */
struct element_t ellipsis_weight;
@@ -47,7 +47,7 @@
/* Known collating elements. */
hash_table elem_table;
-@@ -1455,6 +1476,56 @@
+@@ -1458,6 +1479,56 @@
}
@@ -104,7 +104,7 @@
static void
collate_startup (struct linereader *ldfile, struct localedef_t *locale,
struct localedef_t *copy_locale, int ignore_content)
-@@ -2630,6 +2701,8 @@
+@@ -2656,6 +2727,8 @@
*/
int state = 0;
@@ -113,9 +113,9 @@
/* Get the repertoire we have to use. */
if (repertoire_name != NULL)
repertoire = repertoire_read (repertoire_name);
-@@ -2644,6 +2717,82 @@
- }
- while (nowtok == tok_eol);
+@@ -2670,6 +2743,82 @@
+ }
+ while (nowtok == tok_eol);
+ while (nowtok == tok_define || nowtok == tok_undef)
+ {
@@ -195,8 +195,8 @@
+
if (nowtok == tok_copy)
{
- state = 2;
-@@ -3796,6 +3945,125 @@
+ now = lr_token (ldfile, charmap, result, NULL, verbose);
+@@ -3823,6 +3972,125 @@
repertoire, result, nowtok);
break;
@@ -322,7 +322,7 @@
case tok_end:
/* Next we assume `LC_COLLATE'. */
if (!ignore_content)
-@@ -3825,6 +4093,13 @@
+@@ -3852,6 +4120,13 @@
else if (state == 5)
WITH_CUR_LOCALE (error (0, 0, _("\
%s: missing `reorder-sections-end' keyword"), "LC_COLLATE"));
Modified: glibc-package/branches/glibc-2.7/debian/patches/series
===================================================================
--- glibc-package/branches/glibc-2.7/debian/patches/series 2007-10-29 09:55:59 UTC (rev 2635)
+++ glibc-package/branches/glibc-2.7/debian/patches/series 2007-10-29 21:08:44 UTC (rev 2636)
@@ -1,7 +1,7 @@
locale/check-unknown-symbols.diff
locale/fix-LC_COLLATE-rules.diff -p0
-# locale/preprocessor-collate.diff -p0 # should not be needed anymore, but keep it anyways.
locale/preprocessor-collate-uli-sucks.diff -p0
+locale/preprocessor-collate.diff -p0 # should not be needed anymore, but keep it anyways.
locale/locale-print-LANGUAGE.diff -p0
locale/LC_IDENTIFICATION-optional-fields.diff -p0
locale/fix-C-first_weekday.diff -p0
Reply to: