Does anyone know where in the source code the real functionality behind use warnings resides?
That's in op.c for this particular warning; the relevant code (currently) starts at line 1948, with the check itself starting at line 1954:
1948 if (ckWARN(WARN_VOID)) {
1949 NV nv;
1950 /* don't warn on optimised away booleans, eg
1951 * use constant Foo, 5; Foo || print; */
1952 if (cSVOPo->op_private & OPpCONST_SHORTCIRCUIT)
1953 useless = NULL;
1954 /* the constants 0 and 1 are permitted as they are
1955 conventionally used as dummies in constructs like
1956 1 while some_condition_with_side_effects; */
1957 else if (SvNIOK(sv) && ((nv = SvNV(sv)) == 0.0 || nv == 1.0))
1958 useless = NULL;
1959 else if (SvPOK(sv)) {
1960 SV * const dsv = newSVpvs("");
1961 useless_sv
1962 = Perl_newSVpvf(aTHX_
1963 "a constant (%s)",
1964 pv_pretty(dsv, SvPVX_const(sv),
1965 SvCUR(sv), 32, NULL, NULL,
1966 PERL_PV_PRETTY_DUMP
1967 | PERL_PV_ESCAPE_NOCLEAR
1968 | PERL_PV_ESCAPE_UNI_DETECT));
1969 SvREFCNT_dec_NN(dsv);
1970 }
1971 else if (SvOK(sv)) {
1972 useless_sv = Perl_newSVpvf(aTHX_ "a constant (%"SVf")", SVfARG(sv));
1973 }
1974 else
1975 useless = "a constant (undef)";
1976 }
The special case for 0 and 1 was introduced in April 2001 in this commit (in Perforce rather than git back in those days, of course).