This was actually pretty painful to hear.  Windows-isms aside, I think
this means that we need to target a more ancient C standard in order to
prevent us from veering off as we continue development.  C89 perhaps?

C89 will force us to use older style comments, but I guess that's the
price we pay for TeX Live?

Henry

On Thursday, 13 August 2015 at 10:47:01 am +0200, Élie Roux wrote:
> More explanations on previous patch...
> 
> 
> -------- Message transféré --------
> Sujet : Re: [tex-live] Gregorio integration
> Date : Thu, 13 Aug 2015 10:22:13 +0200 (CEST)
> De : Peter Breitenlohner <[email protected]>
> Pour : Akira Kakuto <[email protected]>
> Copie à : Élie Roux <[email protected]>
> 
> On Thu, 13 Aug 2015, Akira Kakuto wrote:
> 
> > I send you a patch, gregorio400beta.diff, which I'm using
> > for my old Visual Studio 2010. I don't want to bother you
> > with these awkward changes. So please only look over them.
> > I think I will be able to change also the released version in
> > the future, if it is not very different from 4.0.0-beta,
> > to use the Visual Studio 2010.
> 
> Hi Élie, Akira,
> 
> As far as I see the changes in the patch fall into these categories:
> 
> 1. __MINGW__ and/or _WIN32
> simply replace __MINGW__ => _WIN32 (also defined for MinGW)
> 
> 2. postpone kpse_set_program_name() and getopt.h
> already in the attached patch-01-kpathsea
> 
> 3. libgen.h and basename
> could also be handled in patch-01-kpathsea, e.g.,
> +#ifdef USE_KPSE
> +#include <kpathsea/kpathsea.h>
> +#define basename(str) xbasename(str)
> +#else
>   #include <getopt.h>
>   #include <libgen.h>             /* for basename */
> +#endif
> 
> 4. missing return statement
> already in the attached patch-05-return_non_void
> 
> 5. declarations inside a for statement.
> These are C99 and apparently not supported by Visual Studio 2010 and perhaps
> the compilers for some other oldish supported systems.  Although painful, it
> would be best to removed all of them.  There may or may not be a problem
> with the declaration 'gregorio_glyph *glyph' inside the switch statement
> (gregoriotex-write, line 2611); it might be safer to do that outside.
> 
> 6. w32snprintf.h
> Generally speaking, config.h (i.e., the generated file config_.h) should be
> included before any system headers because definitions in config_.h may
> influence the system headers.  That may not apply to Visual Studio, but in
> any case it would be best to include w32snprintf.h (or perhaps the contents
> of it) at the end of config.h.
> 
> 7. utf-8 charactetrs in characters.c and gregoriotex-write.c
> that may or may not be a bug in Visual Studio 2010 but these should be
> avoided for maximum portability (although it is nice to be able to read them
> in an editor).
> 
> 8. stdbool.h
> mandated by C99, but apparently missing in Visual Studio 2010.  No idea
> where to best place the replacement file, perhaps in Akira's sources similar
> to other files (stdint.h?).  No need to define anything for C++, see the
> attached file from gcc 4.8).
> 
> 9. initialization of named struct members
> another nice C99 feature perhaps not supported by some of our compilers.
> 
> 10. "w" vs "wb"
> in TeXLive (and W32TeX) we use "wb" for all output files because they may be
> shared between Unix and Windows systems ("w" and "wb" is the same for Posix
> systems).  If that is undesirable for the non-kpathsea version, one could
> define FOPEN_WBIN_MODE as "w" or "wb" depending on USE_KPSE os simply use
> the present change but only when USE_KPSE is defined.
> 
> Regards
> Peter
> 
> 

>       You must not #include <getopt.h> and <kpathsea/kpathsea.h>
>       (except for Linux).
> 
> diff -ur gregorio-4.0.0-beta.orig/src/gregorio-utils.c 
> gregorio-4.0.0-beta/src/gregorio-utils.c
> --- gregorio-4.0.0-beta.orig/src/gregorio-utils.c     2015-07-05 
> 23:27:56.000000000 +0200
> +++ gregorio-4.0.0-beta/src/gregorio-utils.c  2015-08-03 17:16:42.000000000 
> +0200
> @@ -21,7 +21,11 @@
>  #include <stdio.h>
>  #include <unistd.h>
>  #include <stdlib.h>
> +#ifdef USE_KPSE
> +#include <kpathsea/kpathsea.h>
> +#else
>  #include <getopt.h>
> +#endif
>  #include <libgen.h>             /* for basename */
>  #include <string.h>             /* for strcmp */
>  #include <locale.h>
> @@ -32,9 +36,6 @@
>  #include "characters.h"
>  #include "gabc/gabc.h"
>  #include "vowel/vowel.h"
> -#ifdef USE_KPSE
> -    #include <kpathsea/kpathsea.h>
> -#endif
>  
>  #ifndef MODULE_PATH_ENV
>  #define MODULE_PATH_ENV        "MODULE_PATH"

> diff -ur gregorio-4.0.0-beta.orig/src/gregoriotex/gregoriotex-write.c 
> gregorio-4.0.0-beta/src/gregoriotex/gregoriotex-write.c
> --- gregorio-4.0.0-beta.orig/src/gregoriotex/gregoriotex-write.c      
> 2015-08-03 14:26:26.000000000 +0200
> +++ gregorio-4.0.0-beta/src/gregoriotex/gregoriotex-write.c   2015-08-04 
> 10:13:22.000000000 +0200
> @@ -2674,6 +2674,7 @@
>      }
>  
>      assert(false); // should never reach here
> +    return false; // avoid gcc 5.1 warning
>  }
>  
>  static inline void write_syllable_point_and_click(FILE *const f,

> /* Copyright (C) 1998-2013 Free Software Foundation, Inc.
> 
> This file is part of GCC.
> 
> GCC is free software; you can redistribute it and/or modify
> it under the terms of the GNU General Public License as published by
> the Free Software Foundation; either version 3, or (at your option)
> any later version.
> 
> GCC is distributed in the hope that it will be useful,
> but WITHOUT ANY WARRANTY; without even the implied warranty of
> MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> GNU General Public License for more details.
> 
> Under Section 7 of GPL version 3, you are granted additional
> permissions described in the GCC Runtime Library Exception, version
> 3.1, as published by the Free Software Foundation.
> 
> You should have received a copy of the GNU General Public License and
> a copy of the GCC Runtime Library Exception along with this program;
> see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
> <http://www.gnu.org/licenses/>.  */
> 
> /*
>  * ISO C Standard:  7.16  Boolean type and values  <stdbool.h>
>  */
> 
> #ifndef _STDBOOL_H
> #define _STDBOOL_H
> 
> #ifndef __cplusplus
> 
> #define bool  _Bool
> #define true  1
> #define false 0
> 
> #else /* __cplusplus */
> 
> /* Supporting <stdbool.h> in C++ is a GCC extension.  */
> #define _Bool bool
> #define bool  bool
> #define false false
> #define true  true
> 
> #endif /* __cplusplus */
> 
> /* Signal that all the definitions are present.  */
> #define __bool_true_false_are_defined 1
> 
> #endif        /* stdbool.h */

> _______________________________________________
> Gregorio-devel mailing list
> [email protected]
> https://mail.gna.org/listinfo/gregorio-devel


_______________________________________________
Gregorio-devel mailing list
[email protected]
https://mail.gna.org/listinfo/gregorio-devel

Répondre à