diff options
author | Tom Lane | 2018-05-20 15:40:54 +0000 |
---|---|---|
committer | Tom Lane | 2018-05-20 15:40:54 +0000 |
commit | c6e846446d17db40883eed91fa448e65333a0ae1 (patch) | |
tree | f051ec2ee0c7b3c3c27059496b7d154f9d30585e | |
parent | e7a808f947c66e2e2186c9495359865dadaf511a (diff) |
printf("%lf") is not portable, so omit the "l".
The "l" (ell) width spec means something in the corresponding scanf usage,
but not here. While modern POSIX says that applying "l" to "f" and other
floating format specs is a no-op, SUSv2 says it's undefined. Buildfarm
experience says that some old compilers emit warnings about it, and at
least one old stdio implementation (mingw's "ANSI" option) actually
produces wrong answers and/or crashes.
Discussion: https://postgr.es/m/[email protected]
Discussion: https://postgr.es/m/[email protected]
-rw-r--r-- | contrib/pageinspect/btreefuncs.c | 2 | ||||
-rw-r--r-- | doc/src/sgml/ecpg.sgml | 2 | ||||
-rw-r--r-- | src/backend/access/rmgrdesc/nbtdesc.c | 2 | ||||
-rw-r--r-- | src/interfaces/ecpg/test/compat_informix/sqlda.pgc | 2 | ||||
-rw-r--r-- | src/interfaces/ecpg/test/expected/compat_informix-sqlda.c | 2 | ||||
-rw-r--r-- | src/interfaces/ecpg/test/expected/preproc-outofscope.c | 2 | ||||
-rw-r--r-- | src/interfaces/ecpg/test/expected/sql-sqlda.c | 2 | ||||
-rw-r--r-- | src/interfaces/ecpg/test/preproc/outofscope.pgc | 2 | ||||
-rw-r--r-- | src/interfaces/ecpg/test/sql/sqlda.pgc | 2 |
9 files changed, 9 insertions, 9 deletions
diff --git a/contrib/pageinspect/btreefuncs.c b/contrib/pageinspect/btreefuncs.c index 558a8c41f4..90acf6a4b6 100644 --- a/contrib/pageinspect/btreefuncs.c +++ b/contrib/pageinspect/btreefuncs.c @@ -563,7 +563,7 @@ bt_metap(PG_FUNCTION_ARGS) if (metad->btm_version == BTREE_VERSION) { values[j++] = psprintf("%u", metad->btm_oldest_btpo_xact); - values[j++] = psprintf("%lf", metad->btm_last_cleanup_num_heap_tuples); + values[j++] = psprintf("%f", metad->btm_last_cleanup_num_heap_tuples); } else { diff --git a/doc/src/sgml/ecpg.sgml b/doc/src/sgml/ecpg.sgml index 98b6840520..f0654773f7 100644 --- a/doc/src/sgml/ecpg.sgml +++ b/doc/src/sgml/ecpg.sgml @@ -1678,7 +1678,7 @@ while (1) <para> Here is an example using the data type <type>complex</type> from the example in <xref linkend="xtypes"/>. The external string - representation of that type is <literal>(%lf,%lf)</literal>, + representation of that type is <literal>(%f,%f)</literal>, which is defined in the functions <function>complex_in()</function> and <function>complex_out()</function> functions diff --git a/src/backend/access/rmgrdesc/nbtdesc.c b/src/backend/access/rmgrdesc/nbtdesc.c index 1590d676fb..5c4457179d 100644 --- a/src/backend/access/rmgrdesc/nbtdesc.c +++ b/src/backend/access/rmgrdesc/nbtdesc.c @@ -100,7 +100,7 @@ btree_desc(StringInfo buf, XLogReaderState *record) { xl_btree_metadata *xlrec = (xl_btree_metadata *) rec; - appendStringInfo(buf, "oldest_btpo_xact %u; last_cleanup_num_heap_tuples: %lf", + appendStringInfo(buf, "oldest_btpo_xact %u; last_cleanup_num_heap_tuples: %f", xlrec->oldest_btpo_xact, xlrec->last_cleanup_num_heap_tuples); break; diff --git a/src/interfaces/ecpg/test/compat_informix/sqlda.pgc b/src/interfaces/ecpg/test/compat_informix/sqlda.pgc index 423ce41089..87e0110aed 100644 --- a/src/interfaces/ecpg/test/compat_informix/sqlda.pgc +++ b/src/interfaces/ecpg/test/compat_informix/sqlda.pgc @@ -37,7 +37,7 @@ dump_sqlda(sqlda_t *sqlda) printf("name sqlda descriptor: '%s' value %d\n", sqlda->sqlvar[i].sqlname, *(int *)sqlda->sqlvar[i].sqldata); break; case SQLFLOAT: - printf("name sqlda descriptor: '%s' value %lf\n", sqlda->sqlvar[i].sqlname, *(double *)sqlda->sqlvar[i].sqldata); + printf("name sqlda descriptor: '%s' value %f\n", sqlda->sqlvar[i].sqlname, *(double *)sqlda->sqlvar[i].sqldata); break; case SQLDECIMAL: { diff --git a/src/interfaces/ecpg/test/expected/compat_informix-sqlda.c b/src/interfaces/ecpg/test/expected/compat_informix-sqlda.c index fa2e569bbd..ad3188d1e6 100644 --- a/src/interfaces/ecpg/test/expected/compat_informix-sqlda.c +++ b/src/interfaces/ecpg/test/expected/compat_informix-sqlda.c @@ -142,7 +142,7 @@ dump_sqlda(sqlda_t *sqlda) printf("name sqlda descriptor: '%s' value %d\n", sqlda->sqlvar[i].sqlname, *(int *)sqlda->sqlvar[i].sqldata); break; case SQLFLOAT: - printf("name sqlda descriptor: '%s' value %lf\n", sqlda->sqlvar[i].sqlname, *(double *)sqlda->sqlvar[i].sqldata); + printf("name sqlda descriptor: '%s' value %f\n", sqlda->sqlvar[i].sqlname, *(double *)sqlda->sqlvar[i].sqldata); break; case SQLDECIMAL: { diff --git a/src/interfaces/ecpg/test/expected/preproc-outofscope.c b/src/interfaces/ecpg/test/expected/preproc-outofscope.c index f4676a083a..ef4dadaf9d 100644 --- a/src/interfaces/ecpg/test/expected/preproc-outofscope.c +++ b/src/interfaces/ecpg/test/expected/preproc-outofscope.c @@ -337,7 +337,7 @@ if (sqlca.sqlcode < 0) exit (1);} get_record1(); if (sqlca.sqlcode == ECPG_NOT_FOUND) break; - printf("id=%d%s t='%s'%s d1=%lf%s d2=%lf%s c = '%s'%s\n", + printf("id=%d%s t='%s'%s d1=%f%s d2=%f%s c = '%s'%s\n", myvar->id, mynullvar->id ? " (NULL)" : "", myvar->t, mynullvar->t ? " (NULL)" : "", myvar->d1, mynullvar->d1 ? " (NULL)" : "", diff --git a/src/interfaces/ecpg/test/expected/sql-sqlda.c b/src/interfaces/ecpg/test/expected/sql-sqlda.c index 81d26b3a97..090aaf1a45 100644 --- a/src/interfaces/ecpg/test/expected/sql-sqlda.c +++ b/src/interfaces/ecpg/test/expected/sql-sqlda.c @@ -158,7 +158,7 @@ dump_sqlda(sqlda_t *sqlda) break; #endif case ECPGt_double: - printf("name sqlda descriptor: '%s' value %lf\n", sqlda->sqlvar[i].sqlname.data, *(double *)sqlda->sqlvar[i].sqldata); + printf("name sqlda descriptor: '%s' value %f\n", sqlda->sqlvar[i].sqlname.data, *(double *)sqlda->sqlvar[i].sqldata); break; case ECPGt_numeric: { diff --git a/src/interfaces/ecpg/test/preproc/outofscope.pgc b/src/interfaces/ecpg/test/preproc/outofscope.pgc index aae53250a5..b03743c991 100644 --- a/src/interfaces/ecpg/test/preproc/outofscope.pgc +++ b/src/interfaces/ecpg/test/preproc/outofscope.pgc @@ -101,7 +101,7 @@ main (void) get_record1(); if (sqlca.sqlcode == ECPG_NOT_FOUND) break; - printf("id=%d%s t='%s'%s d1=%lf%s d2=%lf%s c = '%s'%s\n", + printf("id=%d%s t='%s'%s d1=%f%s d2=%f%s c = '%s'%s\n", myvar->id, mynullvar->id ? " (NULL)" : "", myvar->t, mynullvar->t ? " (NULL)" : "", myvar->d1, mynullvar->d1 ? " (NULL)" : "", diff --git a/src/interfaces/ecpg/test/sql/sqlda.pgc b/src/interfaces/ecpg/test/sql/sqlda.pgc index 0f2059f670..2ea5121ac5 100644 --- a/src/interfaces/ecpg/test/sql/sqlda.pgc +++ b/src/interfaces/ecpg/test/sql/sqlda.pgc @@ -45,7 +45,7 @@ dump_sqlda(sqlda_t *sqlda) break; #endif case ECPGt_double: - printf("name sqlda descriptor: '%s' value %lf\n", sqlda->sqlvar[i].sqlname.data, *(double *)sqlda->sqlvar[i].sqldata); + printf("name sqlda descriptor: '%s' value %f\n", sqlda->sqlvar[i].sqlname.data, *(double *)sqlda->sqlvar[i].sqldata); break; case ECPGt_numeric: { |