我目前正在尝试将所有缺失的覆盖添加到项目中,因此我使用Wsuggest-override。
来自文档:
-Wsuggest-倍率
警告覆盖未使用覆盖>关键字标记的虚拟函数。
但是,它会对所有应使用覆盖关键字的功能发出警告,即使关键字实际存在
来自日志:
gcc version 6.4.1 20170727 (Red Hat 6.4.1-1) (GCC)
我是否遗漏了有关此警告用法的内容?
我的gcc是:<?php
include('conn.php');
if (isset($_POST["RegionRequest"])) {
$Region = $_POST["Region"];
$sql = "SELECT DISTINCT country FROM test where region='" . mysqli_real_escape_string($conn, $Region) . "' AND status='Y' ORDER BY country ASC";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
echo json_encode(mysqli_fetch_all($result, MYSQLI_ASSOC));
}
}
if (isset($_POST["CountriesRequest"])) {
$Countries = $_POST["Countries"];
$Region = $_POST["Region"];
$sql = "SELECT DISTINCT state FROM test where country='" . mysqli_real_escape_string($conn, $Countries) . "' AND region='" . mysqli_real_escape_string($conn, $Region) . "' AND status='Y' ORDER BY state ASC";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
echo json_encode(mysqli_fetch_all($result, MYSQLI_ASSOC));
}
}
if (isset($_POST["stateRequest"])) {
$state = $_POST["state"];
$cid = $_POST["cid"];
$Region = $_POST["Region"];
$sql = "SELECT DISTINCT city FROM test where region='" . mysqli_real_escape_string($conn, $Region) . "' AND state='" . mysqli_real_escape_string($conn, $state) . "' and country='" . mysqli_real_escape_string($conn, $cid) . "' AND status='Y' ORDER BY city ASC";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
echo json_encode(mysqli_fetch_all($result, MYSQLI_ASSOC));
}
}
if (isset($_POST["cityRequest"])) {
$city = $_POST["city"];
$state = $_POST["state"];
$cid = $_POST["cid"];
$Region = $_POST["Region"];
$sql = "SELECT suburb FROM test where region='" . mysqli_real_escape_string($conn, $Region) . "' AND city='" . mysqli_real_escape_string($conn, $city) . "' AND state='" . mysqli_real_escape_string($conn, $state) . "' and country='" . mysqli_real_escape_string($conn, $cid) . "' AND status='Y' ORDER BY suburb ASC";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
echo json_encode(mysqli_fetch_all($result, MYSQLI_ASSOC));
}
}
if (isset($_POST["suburbRequest"])) {
$suburb = $_POST['suburb'];
$city = $_POST["city"];
$state = $_POST["state"];
$cid = $_POST["cid"];
$Region = $_POST["Region"];
$sql = "SELECT * FROM test where region='" . mysqli_real_escape_string($conn, $Region) . "' AND state='" . mysqli_real_escape_string($conn, $state) . "' AND country='" . mysqli_real_escape_string($conn, $cid) . "' AND suburb='" . mysqli_real_escape_string($conn, $suburb) . "' AND status='Y'";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
echo json_encode(mysqli_fetch_all($result, MYSQLI_ASSOC));
}
}
?>
答案 0 :(得分:0)
很抱歉,这是一个愚蠢的问题,有一个#define override
删除override关键字,因为该项目曾经是Linux平台的c ++ 99兼容。
删除定义修复了问题。