On 03/12/18 09:27, sur-behoffski wrote:
G'day,
[...]

Following on from my previous message, here is the output from building
CD (from the Subversion repository head, revision 744, not the tarball)
on a Linux Mint system.

The "format not a string literal" messages strewn across the "pptx.c"
driver (Microsoft(R) Office Open Power Point XML format) are an
immediate surprise:  The first occurrence seems to be reasonable code:

    static void printOpenSlideRels(FILE* slideRelsFile)
    {
      const char *rels =
      {
        "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n"
        "(... second line, relationships stuff...)">\n"
        "(...third line, more relationships and schemas stuff...)\n"
      };

      fprintf(slideRelsFile, rels);
    }

(The fprintf line is line 115... the compiler doesn't believe that
"rels" is a string literal.)

This warning can be suppressed simply by changing Line 108, from:

      const char *rels =

to:

      const char * const rels =

and that's it.

(Incidentally, the "C" purist in me looks askance at the C++-style
curly braces in the initialisation, as the preprocessor/compiler
knows to concatenate consecutive string literals; however, we're
looking to only make minimal-risk changes at first, so I'll bite
my tongue (just).)

Just adding "const" as we have above would eliminate about 20
compiler warnings.

For the record, Linux Mint 18.3 has gcc 5.4.x; Gentoo Linux has
gcc 6.4.x and comes up with some differences in the diagnostics.

You can see all the Linux Mint-platform diagnostics in the
attached file.

cheers,

s-b etc.
programmer, Grouse Software
* No diagnostics for:
   #include expects "FILENAME" or <FILENAME>
   missing binary operator before token "("
   <FUNC> is deprecated [-Wdeprecated-declarations]
   <FUNC1> is deprecated: Use <FUNC2> instead [-Wdeprecated-declarations]
   comparison between <ENUM1> and <ENUM2> [-Wenum-compare]
   format <FMT> expects argument of type <TYPE1>, but argument <NUM> has type 
<TYPE2> [-Wformat=]
   too many arguments for format [-Wformat-extra-args]
   assignment from incompatible pointer type [-Wincompatible-pointer-types]
   cast to pointer from integer of different size [-Wint-to-pointer-cast]
   <VAR> is usually a function [-Wmain]
   missing braces around initializer [-Wmissing-braces]
   the use of `tmpnam' is dangerous, better use `mkstemp'
   suggest parentheses around assignment used as truth value [-Wparentheses]
   suggest explicit braces to avoid ambiguous 'else' [-Wparentheses]
   suggest parentheses around '&&' within '||' [-Wparentheses]
   cast from pointer to integer of different size [-Wpointer-to-int-cast]
   <VAR> will be initialized after [-Wreorder]
   no return statement in function returning non-void [-Wreturn-type]
   control reaches end of non-void function [-Wreturn-type]
   case value <LABEL> not in enumerated type <ENUM> [-Wswitch]
   this 'for' clause does not guard... [-Wmisleading-indentation]
   this 'if' clause does not guard... [-Wmisleading-indentation]
   dereferencing type-punned pointer will break strict-aliasing rules 
[-Wstrict-aliasing]
   enumeration value <ENUM> not handled in switch [-Wswitch]
   <VAR> defined but not used [-Wunused-const-variable=]
   <FUNC> defined but not used [-Wunused-function]
   ignoring return value of <FUNC>, declared with attribute warn_unused_result 
[-Wunused-result]
   <VAR> defined but not used [-Wunused-variable]
   unused variable <VAR> [-Wunused-variable]
   variable <VAR> set but not used [-Wunused-but-set-variable]
   warning: ISO C++ forbids converting a string constant to <TYPE> 
[-Wwrite-strings]
   deprecated conversion from string constant to <TYPE> [-Wwrite-strings]
(End of list.)


format not a string literal and no format arguments [-Wformat-security]:
    drv/pptx.c:115:[Function:printOpenSlideRels]: 
      fprintf(slideRelsFile, rels);
    drv/pptx.c:130:[Function:printPresProps]: 
      fprintf(presPropsFile, presProps);
    drv/pptx.c:143:[Function:printRels]: 
      fprintf(relsFile, rels);
    drv/pptx.c:156:[Function:printLayoutRelsFile]: 
      fprintf(layoutRelsFile, rels);
    drv/pptx.c:192:[Function:printLayoutFile]: 
      fprintf(layoutFile, rels);
    drv/pptx.c:205:[Function:printOpenMasterRelsFile]: 
      fprintf(masterRelsFile, rels);
    drv/pptx.c:215:[Function:printCloseMasterRelsFile]: 
      fprintf(masterRelsFile, rels);
    drv/pptx.c:252:[Function:printOpenMasterFile]: 
      fprintf(masterFile, rels);
    drv/pptx.c:270:[Function:printCloseMasterFile]: 
      fprintf(masterFile, rels);
    drv/pptx.c:548:[Function:printThemeFile]: 
      fprintf(themeFile, rels);
    drv/pptx.c:578:[Function:printPresentation]: 
      fprintf(presentationFile, presentationPrefix);
    drv/pptx.c:614:[Function:printContentTypes]: 
      fprintf(ctFile, contentTypesPrefix);
    drv/pptx.c:617:[Function:printContentTypes]: 
      fprintf(ctFile, contentTypesSuffix);
    drv/pptx.c:643:[Function:printPptRelsFile]: 
      fprintf(pptRelsFile, relsPrefix);
    drv/pptx.c:646:[Function:printPptRelsFile]: 
      fprintf(pptRelsFile, relsSuffix);
    drv/pptx.c:658:[Function:printCloseSlide]: 
      fprintf(slideFile, suffix);
    drv/pptx.c:668:[Function:printCloseSlideRels]: 
      fprintf(slideRelsFile, rels);
    drv/pptx.c:944:[Function:pptxClosePath]: 
      fprintf(presentation->slideFile, lineSuffix);
    drv/pptx.c:954:[Function:pptxNoFill]: 
      fprintf(presentation->slideFile, noFill);
    drv/pptx.c:1101:[Function:pptxEndFill]: 
      fprintf(presentation->slideFile, fillEnd);


implicit declaration of function <FUNC> [-Wimplicit-function-declaration]:
    minizip/miniunzip.c:62:[Function:mymkdir]:   mkdir


initialization from incompatible pointer type [-Wincompatible-pointer-types]:
    drv/cdim.c:[At:242]: 
      cdcreatecanvas,


passing argument <NUM> of <FUNC> from incompatible pointer type 
[-Wincompatible-pointer-types]:
    drv/pptx.c:1552:[Function:writeZipFile]:   3  minizip
      ret = minizip(filename, dirname, files, i);
    drv/pptx.c:1554:[Function:writeZipFile]:   2  removeTempFiles
      removeTempFiles(dirname, files, i);


<VAR> may be used uninitialized in this function [-Wmaybe-uninitialized]:
    minizip/minizip.c:137:[Function:minizip]:   fin
        if (fin)
           ^


<EXPRESSION> is used uninitialized in this function [-Wuninitialized]:
    drv/cgm.c:594:[Function:cgmb_putfl64]:   r.l[1]
      cgmb_putb ( cgm, r.l[1] >> 24 );
                              ^


statement with no effect [-Wunused-value]:
    minizip/zip.c:1070:[Function:zipOpenNewFileInZip4_64]: 
        (crcForCrypting);
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users

Reply via email to