(7,4)-Hamming code can be implemented with many different generator/parity-check matrix pairs, or in other words just because an implementation is said to be a (7,4)-Hamming code does not mean that the codewords used will be necessarily be of form \$\{P_1P_2M_1P_4M_2M_3M_4\}\$.
Having the codewords be in the form given above gives the advantage of the value of the syndrome equating the error location, so after we get the syndrome we can just compute the decimal value of our syndrome and just flip that bit. If the codewords are in another form then we will need to match the syndrome obtained to the appropriate column of the parity check matrix in order to evaluate the error location.
Using the classic implementation of the (7,4)-Hamming code (i.e with codewords of form \$\{P_1P_2M_1P_4M_2M_3M_4\}\$) we get a parity check matrix, \$H_1\$, where
$$H_1 = \left( \begin{array}{ccccccc}
1 & 0 & 1 & 0 & 1 & 0 & 1 \\
0 & 1 & 1 & 0 & 0 & 1 & 1 \\
0 & 0 & 0 & 1 & 1 & 1 & 1 \end{array} \right) $$
If there is an error in bit position \$i\$, then the syndrome will be equal to \$c_i\$, where \$c_i\$ is the \$i^{th}\$ column of the parity check matrix. So looking at the parity check matrix in this case you can easily see that the value of the syndrome will equate to the error location.
If you use a non-systematic \$g(x)\$ then the parity check matrix will not have the very nice property we have above. You would need to calculate the syndrome and compare it against each column of the parity check matrix to see which one it matches with, the column number it matches with will be your error location i.e if it matches will column \$c_i\$ then the error is at location \$i\$. The columns of the parity check matrix (and hence the entire parity check matrix H) of the code can be computed directly using \$g(x)\$ and the set of error monomials \$e(x)\$ (\$e(x) = x^i\$). This is done by computing columns as
$$
c_i(x) = \text{Remainder} \left( \frac{e_i(x)}{g(x)} \right) = \text{Remainder} \left( \frac{x^i}{g(x)} \right)
$$
where all computations are in GF(2).