]> granicus.if.org Git - postgresql/commitdiff
Clean up minor warnings from buildfarm.
authorTom Lane <tgl@sss.pgh.pa.us>
Sun, 28 Apr 2019 16:45:55 +0000 (12:45 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Sun, 28 Apr 2019 16:45:55 +0000 (12:45 -0400)
Be more consistent about use of XXXGetDatum macros in new jsonpath
code.  This is mostly to avoid having code that looks randomly
different from everyplace else that's doing the exact same thing.

In pg_regress.c, avoid an unreferenced-function warning from
compilers that don't understand pg_attribute_unused().  Putting
the function inside the same #ifdef as its only caller is more
straightforward coding anyway.

In be-secure-openssl.c, avoid use of pg_attribute_unused() on a label.
That's pretty creative, but there's no good reason to suppose that
it's portable, and there's absolutely no need to use goto's here in the
first place.  (This wasn't actually causing any buildfarm complaints,
but it's new code in v12 so it has no portability track record.)

src/backend/libpq/be-secure-openssl.c
src/backend/utils/adt/jsonpath.c
src/backend/utils/adt/jsonpath_exec.c
src/backend/utils/adt/jsonpath_gram.y
src/test/regress/pg_regress.c

index 4490516b9e2209b67cb9502c8267db5f7c7cc390..c38a71df587f30f82dce3ab9032d00754bf05746 100644 (file)
@@ -1287,24 +1287,22 @@ ssl_protocol_version_to_openssl(int v, const char *guc_name, int loglevel)
 #ifdef TLS1_1_VERSION
                        return TLS1_1_VERSION;
 #else
-                       goto error;
+                       break;
 #endif
                case PG_TLS1_2_VERSION:
 #ifdef TLS1_2_VERSION
                        return TLS1_2_VERSION;
 #else
-                       goto error;
+                       break;
 #endif
                case PG_TLS1_3_VERSION:
 #ifdef TLS1_3_VERSION
                        return TLS1_3_VERSION;
 #else
-                       goto error;
+                       break;
 #endif
        }
 
-error:
-       pg_attribute_unused();
        ereport(loglevel,
                        (errmsg("%s setting %s not supported by this build",
                                        guc_name,
index fb9d85213d4e1ff922ad348d30c879a46ebd8be5..d53d6d33113be825887ce4f88d716b0293c5d457 100644 (file)
@@ -499,7 +499,7 @@ printJsonPathItem(StringInfo buf, JsonPathItem *v, bool inKey,
                case jpiNumeric:
                        appendStringInfoString(buf,
                                                                   DatumGetCString(DirectFunctionCall1(numeric_out,
-                                                                                                                                          PointerGetDatum(jspGetNumeric(v)))));
+                                                                                                                                          NumericGetDatum(jspGetNumeric(v)))));
                        break;
                case jpiBool:
                        if (jspGetBool(v))
index 074cea24ae31c2aeb2b6f120d11ccf52f7724427..ae61b8fa3e638d599074bbd010a422e2643c3f92 100644 (file)
@@ -1742,8 +1742,7 @@ executeNumericItemMethod(JsonPathExecContext *cxt, JsonPathItem *jsp,
                                                                                "be applied to a numeric value",
                                                                                jspOperationName(jsp->type)))));
 
-       datum = NumericGetDatum(jb->val.numeric);
-       datum = DirectFunctionCall1(func, datum);
+       datum = DirectFunctionCall1(func, NumericGetDatum(jb->val.numeric));
 
        if (!jspGetNext(jsp, &next) && !found)
                return jperOk;
@@ -2109,8 +2108,8 @@ static int
 compareNumeric(Numeric a, Numeric b)
 {
        return DatumGetInt32(DirectFunctionCall2(numeric_cmp,
-                                                                                        PointerGetDatum(a),
-                                                                                        PointerGetDatum(b)));
+                                                                                        NumericGetDatum(a),
+                                                                                        NumericGetDatum(b)));
 }
 
 static JsonbValue *
index 76155963fc61e7374b65e421a5265aab03186270..1534b038dda2707b08db0cc366c494dcd0a9f97d 100644 (file)
@@ -359,7 +359,9 @@ makeItemNumeric(JsonPathString *s)
        v = makeItemType(jpiNumeric);
        v->value.numeric =
                DatumGetNumeric(DirectFunctionCall3(numeric_in,
-                                                                                       CStringGetDatum(s->val), 0, -1));
+                                                                                       CStringGetDatum(s->val),
+                                                                                       ObjectIdGetDatum(InvalidOid),
+                                                                                       Int32GetDatum(-1)));
 
        return v;
 }
index 189abbbdf3713abb8f21d934e4f8c6f8c3a19b69..0902b1fa97a0105f976cc74f6bca8799d371b212 100644 (file)
@@ -881,7 +881,9 @@ initialize_environment(void)
        load_resultmap();
 }
 
-pg_attribute_unused()
+#ifdef ENABLE_SSPI
+
+/* support for config_sspi_auth() */
 static const char *
 fmtHba(const char *raw)
 {
@@ -904,7 +906,6 @@ fmtHba(const char *raw)
        return ret;
 }
 
-#ifdef ENABLE_SSPI
 /*
  * Get account and domain/realm names for the current user.  This is based on
  * pg_SSPI_recvauth().  The returned strings use static storage.
@@ -1072,7 +1073,8 @@ config_sspi_auth(const char *pgdata)
                                   accountname, domainname, fmtHba(sl->str)) >= 0);
        CW(fclose(ident) == 0);
 }
-#endif
+
+#endif                                                 /* ENABLE_SSPI */
 
 /*
  * Issue a command via psql, connecting to the specified database